Tuesday, September 22, 2015

SQL -- Deleting Records and Dropping a Table

How to delete a record:



(1) Mike Jones retired

delete from myemployees_RDP0680
                where title = 'CEO'






(2) Dropping a Table
 



drop table myemployees_RDP0680

Sunday, September 13, 2015

SQL -- Updating Data in Table

Here is the current table:



(1) Arun Shah was promoted to Software Engineer II.

update myemployees_RDP0680
                set title = 'Software Engineer II'
                where title = 'Programmer




(2) Mike Jones birthday is today. 

update myemployees_RDP0680
                set age = age+1
                where lastname = 'Jones' and firstname = 'Mike'






SQL -- More Data Selection

Selecting data from employee table using the LIKE condition. Only first names that end in 'n' are selected.



select * from
myemployees_RDP0680
where firstname LIKE '%n'



SQL -- Inserting Data into Table

Insert statement is used to insert or add a row of data into the table.



insert into myemployees_RDP0680
            (firstname, lastname, title, age, salary)
            values ('Mike', 'Jones', 'CEO', 55, 320000)


insert into myemployees_RDP0680
            (firstname, lastname, title, age, salary)
            values ('Sean', 'Mason', 'VP', 50, 200000)


insert into myemployees_RDP0680
            (firstname, lastname, title, age, salary)
            values ('Arun', 'Shah', 'Progammer', 40, 120000)






Select statement is used to show data.

select * from myemployees_RDP0680