1. 程式人生 > >資料庫操作例項

資料庫操作例項

建立一個簡單的表

create database school;             //建立一個叫‘school’的資料庫
use school;		//使用‘school’這個表
create table student(stu_id int not null auto_increment, 
> name char(32) not null, 
> age int(3) not null, 
> register_date date, 
> primary key (stu_id));	//建立一個叫‘student’的表,結構包括‘name,age,register_date,’三個欄位,同時設定了他們的型別,能否為空,預設值是什麼,增加規則是什麼,最後設了這個表的主鍵是誰。