本文涵蓋內容均源於《php&mysql novice to ninja》一書,在此感謝著者「kevin yank」[澳]。
1.建立庫:
creata database db_name
2.建立表:
creata table [db_name.]table_name
default character set charset engine=storage_engine
3.插入單條:
insert
into
from table_name set
column1_name = column1_value,
column2_name = column2_value,
// etc.
1.刪除庫:
drop
database db_name
2.刪除表:
drop
table table_name
3.刪除表內列:
alter
table table_name drop
column col_name
4.刪除單條:
delete
from table_name where conditions
1.修改庫:暫無
2.修改表:
alter
table table_name add
column
new_col_name new_col_details
3.增加表內列:
alter
table table_name add
column col_name col_details
4.修改單條:
update table_name set
col_name = new_value, /* etc. */
where conditions
1.查詢表結構:
describe table_name
2.查詢資料1:
select column1_name, column2_name, /* etc. */
from table_name
在需格式化引號前,加反斜槓(\)進行轉義(escape)。 ↩ SQL Server 增刪改查基礎
主鍵為自增時可不填寫 插入單條資料 insert into product values 008 原子筆 辦公用品 100,null,2019 11 11 insert into product select 008 原子筆 辦公用品 100,null,2019 11 11 插入多條資料 inser...
2020 11 28增刪改查基礎
include include 定義結構體型別 struct customer int loop 1 char key int customernum 1 struct customer customers 100 void getcustomerinfo struct customer custo...
mysql增刪改查效果 mysql增刪改查
檢視所有資料庫 mysql show databases 建立乙個庫ghd並指定字符集為utp8 mysql create database ghd charset utf8 檢視mysql支援的字符集 mysql show char set 建立乙個表,並設定id為主鍵 create table ...