sql基础语句

***select***

select *
from table1, table2
where table1.id *= table2.id --------
左外部连接,table1中有的而table2中没有得以null表示

table1.id =* table2.id --------
右外部连接

select stockname from table1
union [all] ----- union
合并查询结果集,all-保留重复行

select stockname from table2

***insert***

insert into table_name (Stock_name,Stock_number) value ("xxx","xxxx")
value (select Stockname , Stocknumber from Stock_table2)---value
select语句

***update***

update table_name set Stockname = "xxx" [where Stockid = 3]
Stockname = default
Stockname = null
Stocknumber = Stockname + 4

***delete***

delete from table_name where Stockid = 3
truncate table_name -----------
删除表中所有行,仍保持表的完整性

drop table table_name ---------------
完全删除表

posted @ 2012-03-30 15:11  SOD_QWER  阅读(114)  评论(0)    收藏  举报