Home > SQL > Basic SQL commands

Basic SQL commands

Counting down to my last day I’ve received good feedback from co-workers and friends. People don’t tell you how they appreciate your work until you leave but better later than never and it does feel good 🙂

I started working on my SQL skills using SQL Course, an online tutorial that go over the basic commands and allow creating real tables on their server. Using this tutorial you can practice, verify your results and make mistakes.

While I do not have tons of experience I did work with our Oracle database and used the basic commands so I had no problems here.
Here are some of the commands and results while following the tutorial’s instructions.
When creating a table it is very important to use the correct data types and size. Typical mistakes are names, titles or addresses that do not have enough characters. I’ve created an employee table named myemp_rn0112.:

table myemp_rn0112
(firstname varchar(15), lastname varchar(15),
title varchar(30), age number(3), salary number(7))

The next step is populating the table, using the insert command:

insert into myemp_rn0112
(firstname, lastname, title, age, salary)
values (‘Jonei’, ‘Weber’, ‘Secretary’, 28, 19500)

Following the tutorial’s instructions I’ve made few updates to the table, using the update command:

update myemp_rn0112
set salary = salary + 3500
where salary < 35000

The next step is data removal, using the delete command:

from myemp_rn0112
where firstname = ‘Jonei’ and lastname = ‘Weber-Williams’

To final step is table removal – not one row or column but the entire table. Deletion of a table is easy but dangerous and you must be careful.  If you’re sure that there is no need of a table, use the drop command to delete it:

drop table myemp_rn0112

This was just a basic reminder but if you have to refresh your memory this is a good start. My next step is SQL Course2.

  1. No comments yet.
  1. May 19, 2010 at 6:59 am
  2. May 19, 2010 at 6:01 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: