码迷,mamicode.com
首页 > 数据库 > 详细

SQL基础(1)

时间:2015-11-23 01:00:59      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

TB_NAME:表名;COLUMN:字段,列名;CODE:条件;

查询语句:select;

(1)SELECT * FROM TB_NAME;

(2)SELECT COLUMN FROM TB_NAME;

(3)SELECT COLUMN FROM TB_NAME WHERE COLUMN1=.. AND/OR COLUMN2=..;

(4)SELECT COLUMN FROM TB_NAME WHERE (COLUMN1=..AND/OR COLUMN2=..) OR/AND COLUMN3=..;

 

DML(data manipulation language)语句:insert ,delete,update;

对数据进行操作。

INSERT:

(1)INSERT INTO TB_NAME(COLUMN1,COLUMN2,)

VALUES(.. , ..);

(2)INSERT INTO TB_NAME(COLUMN1,COLUMN2,)

VALUES(.. , ..),(.. , ..)...;

没有的COLUMN一般默认为null;

 DELETE:

(1) DELETE FROM TB_NAME;

(2)DELETE FROM TB_NAME WHERE CODE1;

(3)DELETE FROM TB_NAME WHERE CODE1 AND/OR CODE2;

UPDATE:

(1)UPDATE TB_NAME SET COLUMN1=VALUE1;

(2)UPDATE TB_NAME SET COLUMN1=VALUE1, COLUMN2=VALUE2...;

(3)UPDATE TB_NAME SET COLUMN1=VALUE1 WHERE CODE1;

(4)UPDATE TB_NAME SET COLUMN1=VALUE1, COLUMN2=VALUE2... WHERE CODE1 AND/OR CODE2;

 

SQL基础(1)

标签:

原文地址:http://www.cnblogs.com/zyh2017/p/4986698.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!