表結構和表資料的增刪查改

2021-10-06 23:20:03 字數 1613 閱讀 9512

desc【表名稱】;
alter

table 【表名稱】 add 【新列名】 【列型別】;

alter

table 【表名稱】 drop 【列名稱】;

alter

table 【表名稱】 change 【舊列名】 【新列名】 【新列型別】;

alter

table 【表名稱】 modify 【列名】 【列新型別】;

alter

table 【表名稱】 rename 【表新名稱】;

insert

into 【表名稱】 values

(【有幾個列,就要新增幾個對應列資料型別的資料,中間以逗號分隔】)

;eg:

insert

into 表名稱 values

(值1, 值2,.

...)

;

insert

into 【表名稱】(【指定列,中間以逗號分隔】)

values

(【有幾個指定列,就要新增幾個對應指定列資料型別的資料,中間以逗號分隔】)

;eg:

insert

into table_name(列1

, 列2,.

..)values

(值1, 值2,.

...)

;

delete

from 【表名稱】;

delete

from 【表名稱】 where 【條件】;

eg:delete

from table1 where name=

"abc"

;

select

*from 【表名稱】;

select 【某些列名,中間以逗號分隔】 from 【表名稱】;

eg:select 列1

,列2,······ from 表名稱;

select

*from 【表名稱】 where 【條件】;

update 【表名稱】 set 【某一列名=值,多個列名=值 中間以逗號分隔】;

eg:update table1 set name =

'abc'

;update table1 set age =

18,name =

'abc'

;

update 【表名稱】 set 【某一列名=值,多個列名=值 中間以逗號分隔】 where 【條件】;

eg:update table1 set name =

'abc'

where id =1;

update table1 set age =

18,name =

'abc'

where *** =

'男';

表結構的增刪查改

alter table table name 改變方式 alter table customeradd gender char 1 alter table customerchange address addr char 50 alter table customer modify addr cha...

表資料的增刪查改

1 查詢資料,用一張空的表進行資料的增刪查改 2 新增一條資料,並且輸入乙個空的值,一次只能插入 一條資料 3 更新一條資料,如不指定那條資料,則表中的資料就會被全部更新 4 刪除一條資料,查詢資料出來,然後通過where進行條件排除進行刪除 查詢表 select from my ption 新增一...

資料結構 順序表 增刪查改

include include include include list.h 函式名 createlist 函式功能 建立線性表 引數 無 list createlist void return plist 函式名 destroylist 函式功能 銷毀線性表 函式返回值 無。void destro...