+ -

Pages

Wednesday, July 11, 2012

SQL Most important examples

select * from table
select name, badge from table
select distinct course_code from table
select * from table where course_code = 'SSM103' and date = '25-Apr-12'
select * from table where course_code = 'SSM103' or course_code = 'NWO103' 
select * from test where course_code='SSM103' order by time
select * from test where course_code='SSM103' order by time desc #or asc but that's the default anyway

insert into table values ("87943","Ahmed Salah","SSM103")
insert into table (badge, name) values ("87943","Ahmed Salah") #when specific data only needs to inserted into specific columns

update table set date='28-Apr-12' , time='10:00-12:00' where course_code='EPC102' and time='10:00-11:00'

Delete from table where course_code='SPO10' and date='12-Apr-12' #this deletes all the records that contain this criteria





5 Khalid's Python Journal: SQL Most important examples select * from table select name, badge from table select distinct course_code from table select * from table where course_code = 'SS...

No comments:

Post a Comment

< >