1.創建庫:create database 庫名 charset utf8;
2.使用庫:use 庫名;
3.創建表 : create table 表名( 欄位名 資料型別(長度) 約束條件 注釋, );
#約束條件:
a.[not null | null] 欄位是否可以為空,(默認為null)
b.[default default_value] 默認值
c.[auto_increment] 自動增長(默認+1)
d.[unique [key] 唯一值約束,
e. [primary] key] 主鍵約束 (唯一、不能為空
f.[comment ‘string’] 注釋
g.[reference_definition] 外鍵設定
4.使用資料庫:show database 庫名
5.洗掉資料庫: drop database 庫名
6.洗掉資料庫表:drop table 表名
7.查看資料表全部資訊:select * from 表名
8.向表中插入資料:insert into 表名
9.表記錄的修改:update table 表名 值where 條件
10.資料洗掉:delete from 表名 where 值
11.查看創建的表結構:desc 表名
12.資料型別
(1)、整型:
(2)、浮點型(float和double)
(3)、定點數(decimal)
(4)、字串(char,varchar,_text)
char和varchar的區別:char列的長度被固定為創建表所宣告的長度,取值范圍為1~225,varchar列的值是變長的字串,取值和char一樣,
(5)、二進制資料(_Blob)
(6).日期時間型別
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/199407.html
標籤:其他
上一篇:PostgreSQL 配置優化
下一篇:Mysql性能調優(三)
