下列是张基础表(本人用的是Webyog SQLyog软件 )

 

CREATE TABLE fop

(

fopId INT PRIMARY KEY AUTO_INCREMENT,

fopName VARCHAR(20),

exe VARCHAR(20),

mop VARCHAR(20),

STATUS INT

)

INSERT INTO fop(fopName,exe,mop,STATUS) VALUES ('晓晓','男','跑',1),('看你晓','男','跑',1),('动漫晓','男','跑',1),('放假晓','男','跑',1);

“查询整个表”

SELECT * FROM fop

 

***下划线的需要添加表名***

 下列是执行语句------

 

“查询一列”

SELECT exe FROM fop

“查询多列”

SELECT exe ,mop FROM fop

 

“插入一行”

INSERT INTO fop(fopName,exe,mop,STATUS) VALUES ('苗苗','女','走',1)

“插入多行”

INSERT INTO fop(fopName,exe,mop,STATUS) VALUES ('康康','女','走',1),('炎炎','女','走',1)

 

“更新数据库中的数据”

UPDATE fop

SET  mop='飞', STATUS='10' ,exe='女'

WHERE fopName='动漫晓';

 

“删除表”

DROP TABLE

“删除一行”

DELETE FROM fop WHERE fopname='苗苗' AND STATUS='1';

“删除所有行,保留表”

 

DELETE * FROM fopname

 

“新建数据库”“数据库里包含表,多个表”

CREATE DATABASE

“新建表”

CREATE TABLE

 

SELECT * FROM fop

 

“添加列”

ALTER TABLE fop

ADD kop DATE

“删除列”

ALTER TABLE fop

DROP COLUMN kop

 

 

仅供参考,一定要多动手,内容不完整,可自行摘选,不喜勿喷