求sql語句,高手進

2023-01-25 12:55:30 字數 735 閱讀 1660

1樓:匿名使用者

sql語句----

查詢語句-select * from table;

select * from table where 條件1=數值 and 條件2=數值;

select * from table where id in (select id from table);兩表關聯

select a.a,b.b,c.c from table1 a,table2 b,table3 c where a.id1=b.id2;

插入語句-insert into table (欄位1,欄位2,欄位3,……)

values (數值1,數值2,數值3,……);

更新語句-update 表名 set 數值 where=id = 1;

新增列語句-alter table 表名

add (列名1 型別1,列名2 型別2,列名3 型別3,……);

修改列型別-alter table 表名

modify (列名1 型別1,列名2 型別2,列名3 型別3,……);

刪除列語句-alter table 表名

drop column 列名;

刪除表語句-deltet table 表名;

清空表資料-truncate table 表名;

2樓:匿名使用者

number的空缺好找

你要新增成什麼樣

id=幾?number=5

求高手幫寫一條SQL語句

問題 假設有張學生成績表 tb 如下 姓名 課程 分數 張三 語文 74 張三 數學 83 張三 物理 93 李四 語文 74 李四 數學 84 李四 物理 94 想變成 得到如下結果 姓名 語文 數學 物理 李四 74 84 94 張三 74 83 93 create table tb 姓名 va...

sql語句,請教。。高手指點

select t1.isnull t2.b2,0 from 表a t1 left join 表b t2 on t1.t t2.t union all select t2.t,isnull t1.a1,0 t2.b2 from 表a t1 right join 表b t2 on t1.t t2.t w...

sql語句求優化,聽說NOT IN語句不好求優化

還要注意是在哪一種資料庫管理系統中,有些就不支援minus,不過not exists應該都支援。select name from test1 a where not exists select from test2 b where b.name admin and b.name a.name sql...