create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎么使用?

2)表本身(非表数据)的基本操作:

CREATE TABLE 表名 (列_1_名 列_1_类型 列_1_细节,
     列_2_名 列_2_类型 列_2_细节,
    ...   
    );
例如:create table student(id int not null,name char(10),age int);
例如:CREATE TABLE t (id INT NOT NULL, last_name CHAR(30) NOT NULL, first_name CHAR(30) NOT NULL, d DATE NOT NULL);
 

show tables;显示当前数据库中的Tables
describe table_name;显示table各字段信息
DROP TABLE t; (删除表)
DROP TABLE t1, t2, t3;
ALTER TABLE t ADD x INT NOT NULL;(增加一列)
ALTER TABLE t DROP x; (删除y)
 

3)表数据的基本操作:

添加纪录:
INSERT INTO 表名 (列_list) VALUES (值_list);

例如:
INSERT INTO student (id,name,age) VALUES(1,'liyaohua',25);

INSERT INTO student (id,name,age) VALUES(2,'fuwenlong',26);

详情请见:http://www.mark-to-win.com/index.html?content=Mydb/DBUrl.html&chapter=Mydb/DBIntroduction_web.html#TableOper

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/84493662