# 登入mysql 密碼
$ mysql -u root -p12345612
# 退出mysql資料庫伺服器
exit
;
-- 顯示所有資料庫
show
databases
;-- 建立資料庫
create
database test;
-- 切換資料庫
use test;
-- 顯示資料庫中的所有表
show
tables
;-- 建立資料表
create
table pet (
name varchar(20
),owner varchar(20
),species varchar(20
),*** char(1
),birth date
, death date);
-- 檢視資料表結構
-- describe pet;
desc pet;
-- 查詢表
select
*from pet;
-- 插入資料
insert
into pet values
('puffball'
,'diane'
,'hamster'
,'f'
,'1990-03-30'
,null);
-- 修改資料
update pet set name =
'squirrel'
where owner =
'diane'
;-- 刪除資料
delete
from pet where name =
'squirrel'
;-- 刪除表
drop
table myorder;
sqlite3 常用語法 增刪改查
字數839 閱讀703 喜歡3 建立表名 t student 主鍵為 id create table t student id integer primary key,name text,age integer,score real 如果不存在就建立 create table if not exis...
mysql常用語法 MySQL常用語法
更新資料 update 表名 set 健名 更改的值 where 建 刪除資料 delete from 表名 where 索引 create index 索引名稱 on 表名 鍵名 建立試圖 create view 檢視名 鍵,鍵 as select matchno,abs won lost fro...
mysql基本常用語法 mysql 常用語法
1.1.開啟 service mysql start 1.2.關閉 service mysql stop 1.3.重啟 service mysql restart 2.1.密碼明文 語法 mysql u使用者名稱 p使用者密碼 舉例 mysql uroot p123456 2.2.密碼密文 語法 m...