首页 SQL语言基本语句介绍

SQL语言基本语句介绍

举报
开通vip

SQL语言基本语句介绍SQL语言基本语句介绍 表的建插入数据 修改数据 立 删除数表结构的修表的删除 据 改 查询语 句 , 表的建立 关系数据库的主要特点之一就是用表的方式组织数据。表是SQL语言存放数据、查找数据以及更新数据的基本数据结构。在SQL语言中,表有严格的定义,它是一种二维表,对于这种表有如下规定: 1)每一张表都有一个名字,通常称为表名或关系名。表名必须以字母开头,最大长度为30个字符。 2)一张表可以由若干列组成,列名唯一,列名也称作属性名。 3)表中的一行称为一个元组,它相当于一条记录。 4)同一列的...

SQL语言基本语句介绍
SQL语言基本语句介绍 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 的建插入数据 修改数据 立 删除数表结构的修表的删除 据 改 查询语 句 , 表的建立 关系数据库的主要特点之一就是用表的方式组织数据。表是SQL语言存放数据、查找数据以及更新数据的基本数据结构。在SQL语言中,表有严格的定义,它是一种二维表,对于这种表有如下规定: 1)每一张表都有一个名字,通常称为表名或关系名。表名必须以字母开头,最大长度为30个字符。 2)一张表可以由若干列组成,列名唯一,列名也称作属性名。 3)表中的一行称为一个元组,它相当于一条记录。 4)同一列的数据必须具有相同的数据类型。 5)表中的每一个列值必须是不可分割的基本数据项。 注意:当用户需要新的数据结构或表存放数据时,首先要生成一个表。 语法: CREATE TABLE 表名 [表约束] 列名1 数据类型 [缺省值1,列约束1] ( (列名2 数据类型 [缺省值2,列约束2] … 列名n 数据类型 [缺省值n,列约束n] [TABLESPACE 表空间名称] [STORAGE (存贮的子句)] [ENABLE 约束名] [DISABLE 约束名] repercussions in the province. (C) persistent catch system system. Is a specification "uses". Full implementation of the battalion officers "double selection exam", technology leaders, "fair up" requirements for cadres sought before any discipline, ensure choice and employment fair, to ensure that no sick promotions, personnel selection is realized "zero" Corps evaluation team party group, detachment personnel selection public confidence and satisfaction ranked first in the province. Second, specification of "money". Revision of the financial regulation and many other provisions, fully implement the "three requirements" ... Building better adapted to the demand. 1.2 audit supervision and inevitable result of the transformation of the function of the Audit Commission's "Twelve-Five" audit development plan emphasizes: "exploring innovation audit methods and techniques, in-depth summary of audit experience, continue to explore our audit of the development of ways and means." Auditor-General of the National Audit Office Liu Jiayi in the 2013 national audit institutions honest meeting, pointed out that: "the audit to reveal and reflect the imperfections of laws and regulations to promote regulations; to reveal and reflect issues of ignoring the law, lax law enforcement, promoting strict law enforcement to reveal and reflect omissions, as questions, promote the transformation of government functions and work style." Strengthening audit development of exploration, is to change the auditing function, innovation way, improve the content and other aspects , 插入数据 当一个表新建成时,它里面没有数据,通过向表中扦入数据,建成表的实例。 语句句法: INSERT INTO 表名[(列名1,…)] VALUES(值1,值2,…,值n) [子查询]; 假设有一张表Student如下所示: NO NAME AGE 1001 A 12 1002 B 14 将新学生E增加到上表中,并按照表的结构将信息添加完整,需要如下语句: INSERT INTO STUDENT VALUSE(1003, 'E',12); , 修改数据 对表中已有数据进行修改,语句句法: UPDATE 表名SET 列名1,表达式1,列名2,表达式2,… WHERE 条件; 例如:对下表Student NO NAME AGE 1001 A 12 1002 B 14 将B的年纪改为18;应该执行以下语句: UPDATE STUDENT SET AGE=18 WHERE NAME='B'; repercussions in the province. (C) persistent catch system system. Is a specification "uses". Full implementation of the battalion officers "double selection exam", technology leaders, "fair up" requirements for cadres sought before any discipline, ensure choice and employment fair, to ensure that no sick promotions, personnel selection is realized "zero" Corps evaluation team party group, detachment personnel selection public confidence and satisfaction ranked first in the province. Second, specification of "money". Revision of the financial regulation and many other provisions, fully implement the "three requirements" ... Building better adapted to the demand. 1.2 audit supervision and inevitable result of the transformation of the function of the Audit Commission's "Twelve-Five" audit development plan emphasizes: "exploring innovation audit methods and techniques, in-depth summary of audit experience, continue to explore our audit of the development of ways and means." Auditor-General of the National Audit Office Liu Jiayi in the 2013 national audit institutions honest meeting, pointed out that: "the audit to reveal and reflect the imperfections of laws and regulations to promote regulations; to reveal and reflect issues of ignoring the law, lax law enforcement, promoting strict law enforcement to reveal and reflect omissions, as questions, promote the transformation of government functions and work style." Strengthening audit development of exploration, is to change the auditing function, innovation way, improve the content and other aspects , 删除数据 删除表中已有数据,不能删除不存在的数据。 语句句法: DELETE FROM 表名 WHERE 条件; 例如: 对下面Student表进行删除,要删除其中年纪为12的学生; NO NAME AGE 1001 A 12 1002 B 14 DELETE FROM STUDENT WHERE AGE,12; , 表结构的修改 在已存在的表中增加新列,语句句法: ALTER TABLE 表名 ADD(新列名 数据类型(长度)); 例如: ALTER TABLE STUDENT ADD (DEPARTMENT CHAR(8)); b.增加已有列的数据类型。 例如: ALTER TABLE STUDENT MODIFY(NAME VARCHAR2(25)); , 表的删除 将已经存在的表删除,语句句法: DROP TABLE表名; 例如: DROP TABLE EMP; repercussions in the province. (C) persistent catch system system. Is a specification "uses". Full implementation of the battalion officers "double selection exam", technology leaders, "fair up" requirements for cadres sought before any discipline, ensure choice and employment fair, to ensure that no sick promotions, personnel selection is realized "zero" Corps evaluation team party group, detachment personnel selection public confidence and satisfaction ranked first in the province. Second, specification of "money". Revision of the financial regulation and many other provisions, fully implement the "three requirements" ... Building better adapted to the demand. 1.2 audit supervision and inevitable result of the transformation of the function of the Audit Commission's "Twelve-Five" audit development plan emphasizes: "exploring innovation audit methods and techniques, in-depth summary of audit experience, continue to explore our audit of the development of ways and means." Auditor-General of the National Audit Office Liu Jiayi in the 2013 national audit institutions honest meeting, pointed out that: "the audit to reveal and reflect the imperfections of laws and regulations to promote regulations; to reveal and reflect issues of ignoring the law, lax law enforcement, promoting strict law enforcement to reveal and reflect omissions, as questions, promote the transformation of government functions and work style." Strengthening audit development of exploration, is to change the auditing function, innovation way, improve the content and other aspects , 查询语句 SELECT命令的语法为: SELECT [DISTINCT|ALL] {*|模式名.] {表名|视图名| 快照名] .*…| {表达式[列别名]…} } [, [模式名. ] {表名| 视图名|} .*…| 表达式[列别名] ]… FROM [模式名.] {表名|视图名|快照名} [@数据库链名] [表别名] [, [模式名.] {表名|视图名|快照名} [@数据库链名] [表别名] ]… [WHERE条件] [START WITH条件 CONNECT BY 条件] [GROUP BY表达式[,表达式] …[HAVING条件] [UNION|UNION ALL |INTERSECT|MINUS]SELECT命令 [ORDER BY{表达式|位置} [ASC|DESC] [, {表达式|位置[ASC|DESC]}]…] 例如:对于STUDENT表: NO NAME AGE 1001 AE 12 1002 BT 14 (1) 查询年纪为12的学生姓名; SELECT STUDENT.NAME FROM STUDENT WHERE AGE=12; (2) 查询年纪在12至16岁之间的学生姓名; SELECT STUDENT.NAME FROM STUDENT WHERE AGE BETWEEN 12 AND 16; (3) 查询年纪不在12至16岁之间的学生姓名; SELECT STUDENT.NAME FROM STUDENT WHERE AGE NOT BETWEEN 12 AND 16; repercussions in the province. (C) persistent catch system system. Is a specification "uses". Full implementation of the battalion officers "double selection exam", technology leaders, "fair up" requirements for cadres sought before any discipline, ensure choice and employment fair, to ensure that no sick promotions, personnel selection is realized "zero" Corps evaluation team party group, detachment personnel selection public confidence and satisfaction ranked first in the province. Second, specification of "money". Revision of the financial regulation and many other provisions, fully implement the "three requirements" ... Building better adapted to the demand. 1.2 audit supervision and inevitable result of the transformation of the function of the Audit Commission's "Twelve-Five" audit development plan emphasizes: "exploring innovation audit methods and techniques, in-depth summary of audit experience, continue to explore our audit of the development of ways and means." Auditor-General of the National Audit Office Liu Jiayi in the 2013 national audit institutions honest meeting, pointed out that: "the audit to reveal and reflect the imperfections of laws and regulations to promote regulations; to reveal and reflect issues of ignoring the law, lax law enforcement, promoting strict law enforcement to reveal and reflect omissions, as questions, promote the transformation of government functions and work style." Strengthening audit development of exploration, is to change the auditing function, innovation way, improve the content and other aspects (4) 查询所有姓名以A开头的学生的姓名; SELECT STUDENT.NAME FROM STUDENT WHERE NAME LIKE 'A%'; (5) 列出所有学生年纪的和,年纪的平均值,最大值,最小值,最大值与最小值 之间的差值; SELECT AVG(AGE), SUM(AGE), MAX(AGE), MIN(AGE), MAX(AGE)-MIN(AGE); (6) 将所有学生按学号顺序升序排列; SELECT * FROM STUDENT ORDER BY NO DESC; (7) 将所有学生按学号顺序升序排列; SELECT * FROM STUDENT ORDER BY NO ASC; repercussions in the province. (C) persistent catch system system. Is a specification "uses". Full implementation of the battalion officers "double selection exam", technology leaders, "fair up" requirements for cadres sought before any discipline, ensure choice and employment fair, to ensure that no sick promotions, personnel selection is realized "zero" Corps evaluation team party group, detachment personnel selection public confidence and satisfaction ranked first in the province. Second, specification of "money". Revision of the financial regulation and many other provisions, fully implement the "three requirements" ... Building better adapted to the demand. 1.2 audit supervision and inevitable result of the transformation of the function of the Audit Commission's "Twelve-Five" audit development plan emphasizes: "exploring innovation audit methods and techniques, in-depth summary of audit experience, continue to explore our audit of the development of ways and means." Auditor-General of the National Audit Office Liu Jiayi in the 2013 national audit institutions honest meeting, pointed out that: "the audit to reveal and reflect the imperfections of laws and regulations to promote regulations; to reveal and reflect issues of ignoring the law, lax law enforcement, promoting strict law enforcement to reveal and reflect omissions, as questions, promote the transformation of government functions and work style." Strengthening audit development of exploration, is to change the auditing function, innovation way, improve the content and other aspects
本文档为【SQL语言基本语句介绍】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_014457
暂无简介~
格式:doc
大小:32KB
软件:Word
页数:0
分类:
上传时间:2018-06-13
浏览量:9