常用的SQL語句

2021-06-19 03:05:50 字數 1134 閱讀 7486

1.select語句
語法:

select語句的基本語法如下:

select column1, column2,..., columnn from table_name;

這裡列1,列2...想獲取其值表的字段。如果想獲取在該字段的所有可用字段,那麼可以使用下面的語法:

select * from table_name;

2.insert語句
語法:

有兩個基本的insert into語句的語法如下:

insert into table_name (column1, column2, column3,...columnn)]  values (value1, value2, value3,...valuen);

這裡column1,column2,... columnn,要插入資料表中的列的名稱。

可能不需要在sql查詢中指定列的名字,如果要新增的所有表中的列的值。但要確保值的順序是相同的順序表中的列。 sql insert into語法如下:

insert into table_name values (value1,value2,value3,...valuen);

3.update語句
語法:

update where子句的查詢的基本語法如下:

update table_name set column1 = value1, column2 = value2...., columnn = valuen where [condition];

可以將n多的條件下使用and或or運算。

4.delete語句
語法:

基本語法delete查詢的where子句如下:

delete from table_name where [condition];

可以將n多的條件下使用and或or運算。

sql常用sql語句

1 查詢某個庫中所有的表名字 select name from sysobjects where xtype u and name dtproperties order by name 2 得到資料庫中所有使用者檢視 select name from sysobjects where xtype v...

sql 常用的語句

說明 複製表 只複製結構,源表名 a 新錶名 b sql select into b from a where 1 1 說明 拷貝表 拷貝資料,源表名 a 目標表名 b sql insert into b a,b,c select d,e,f from b sql select a.title,a....

常用的SQL語句

表的結構如下 mysql show create table person person create table person number int 11 default null,name varchar 255 default null,birthday date default null e...