省防办数据结构SQL语句
sql语言的三大类语句
sql语言的三大类语句SQL(Structured Query Language)是一种专门用于管理和操作关系型数据库的语言。
它被广泛应用于从小型企业到大型组织等各种规模的数据库管理系统中。
SQL语言包含了多种类型的语句,但总体上可以分为三大类:数据操纵语言(DML)、数据定义语言(DDL)和数据控制语言(DCL)。
一、数据操纵语言(DML)数据操纵语言主要用于从数据库中检索、插入、更新和删除数据。
下面是一些常见的DML语句:1. SELECT语句:SELECT语句用于从一个或多个表中检索数据。
它允许我们指定要检索的列和查询的条件,以满足特定的需求。
示例:SELECT 列名 FROM 表名 WHERE 条件;2. INSERT语句:INSERT语句用于将新的数据插入到数据库表中。
示例:INSERT INTO 表名 (列名1, 列名2, ...) VALUES (值1, 值2, ...);3. UPDATE语句:UPDATE语句用于更新表中已经存在的数据。
示例:UPDATE 表名 SET 列名 = 值 WHERE 条件;4. DELETE语句:DELETE语句用于从表中删除数据。
示例:DELETE FROM 表名 WHERE 条件;二、数据定义语言(DDL)数据定义语言主要用于创建、修改和删除数据库对象,例如表、视图、索引等。
下面是一些常见的DDL语句:1. CREATE语句:CREATE语句用于创建新的数据库对象,如表、视图和索引。
示例:CREATE TABLE 表名 (列名1 数据类型, 列名2 数据类型, ...);2. ALTER语句:ALTER语句用于修改现有的数据库对象,如表结构、列定义等。
示例:ALTER TABLE 表名 ADD 列名数据类型;3. DROP语句:DROP语句用于删除数据库对象。
示例:DROP TABLE 表名;三、数据控制语言(DCL)数据控制语言用于定义数据库的安全性和完整性约束,以及授权和回收用户对数据库对象的访问权限。
数据库SQL语句大全,最常用的SQL语句
数据库SQL语句⼤全,最常⽤的SQL语句检索数据检索单个列:SELECT pname FROM product检索多个列:SELECT pname,market_price,is_hot FROM product检索所有列:SELECT * FROM product过滤检索结果中的重复数据:SELECT DISTINCT market_price FROM productDISTINCT关键字:1、返回不同的值,使⽤时放在列名的前⾯2、多查询⼀个及以上列时,除⾮你查询的所有列的数据都不同,否则所有⾏都将被检索出来限制检索结果:SELECT pname FROM product LIMIT 5,5limit5,5指⽰mysql返回从⾏5开始的5⾏记录排序检索数据排序数据SELECT pname FROM product ORDER BY pname按多个列排序数据SELECT pid,market_price,pname FROM product ORDER BY market_price,pname按多个列排序时,排序列之间⽤,隔开,并且按列的顺序来排序数据,先排价格,后排名称指定排序⽅向降序排序(按照价格降序排序)SELECT pid,market_price,pname FROM product ORDER BY market_price DESC升序排序(mysql查询时默认就是升序排序)SELECT pid,market_price,pname FROM product ORDER BY market_price ASC找出价格最贵的商品(使⽤order BY 和limit关键字)SELECT market_price FROM product ORDER BY market_price DESC LIMIT 1过滤数据使⽤WHERE⼦句价格等于19800的商品SELECT pname,market_price FROM product WHERE market_price=19800价格⼩于于19800的商品SELECT pname,market_price FROM product WHERE market_price<19800价格⼤于800的商品SELECT pname,market_price FROM product WHERE market_price>800价格在800到10000之间SELECT pname,market_price FROM product WHERE market_price BETWEEN 800 AND 10000where中的操作符有以下⼏个= 等于<> 不等于!= 不等于< ⼩于<= ⼩于等于> ⼤于>= ⼤于等于BETWEEN 在指定的两个值之间数据过滤组合where语句and操作符(同时符合where后⾯的条件)SELECT pname,market_price FROM product WHERE market_price>1000 AND is_hot=0or操作符(只需要符合where后⾯的⼀个条件的结果都会显⽰出来)SELECT pname,market_price FROM product WHERE market_price>1000 OR is_hot=0IN操作符(⽤来指定条件范围)SELECT pname,market_price FROM product WHERE market_price IN(238,19800,1120) ORDER BY pnameNOT操作符(否定它之后所跟的条件)SELECT pname,market_price FROM product WHERE market_price NOT IN(238,19800,1120) ORDER BY pname⽤通配符进⾏过滤like操作符(通配符模糊搜索)%通配符(找出product表中所有商品名以韩版开头的商品)SELECT pname FROM product WHERE pname LIKE '韩版%'找出product表中商品名称含有“⼥”的商品,不管开头结尾是什么内容SELECT pname FROM product WHERE pname LIKE '%⼥%'下划线_通配符(⽤途和%⼀样,不过_只匹配单个字符)SELECT pname,market_price FROM product WHERE market_price LIKE '_99'正则表达式搜索基本字符串匹配SELECT pname FROM product WHERE pname REGEXP '韩版' ORDER BY pname使⽤正则表达式需要⽤REGEXP关键字,并在REGEXP后⾯跟上正则表达式内容SELECT pname FROM product WHERE pname REGEXP '.版' ORDER BY pname.是正则表达式语⾔中⼀个特殊的字符。
sql数据库语句
sql数据库语句
SQL(Structured Query Language)是一种结构化查询语言,用于存储,检索,更改和删除用户在关系型数据库系统(RDBMS)中存储的数据,是数据库开发的标准语言。
SQL语句旨在为用户提供使其可以执行特定任务的基本能力。
它们的主要目标是提供一种方便的方法,用于收集,存储,控制,重组和重新定位用户存储在数据库中的数据。
SQL语句可以用于查找,修改和更新数据库数据,创建和删除数据库对象,控制访问某些数据特定的对象,以及处理大量数据。
下面列举几个常见的SQL语句:
SELECT:语句用于从数据库表中检索数据;
DROP:语句用于从数据库中删除表和对象;
TRANSCATION:语句用于控制数据库事务;
GRANT:语句用于给指定标识符授予数据库对象访问权限;
SQL语句可以被用于控制,访问,管理和操作数据,并助于实现高效的数据结果集。
它的功能非常强大,但它的权限需要正确的分配和安全措施才能完全符合期望。
结构化查询语言sql语句
结构化查询语言sql语句SQL(Structured Query Language)是一种用于管理关系数据库系统的计算机语言。
它通过使用特定的语法和命令,可以对数据库进行增删改查等操作。
下面列举了10个常用的SQL语句,以及它们的功能和使用方法。
1. SELECT语句SELECT语句用于从数据库中检索数据。
它可以指定要查询的列、表以及查询条件,返回满足条件的数据集合。
例如:```SELECT * FROM employees;```上述语句将返回employees表中的所有数据。
2. INSERT语句INSERT语句用于向数据库中插入新的数据行。
它可以指定要插入的表、列和对应的值。
例如:```INSERT INTO customers (name, email) VALUES ('John', '****************');```上述语句将在customers表中插入一条新的数据行,包含name和email两个列的值。
3. UPDATE语句UPDATE语句用于更新数据库中的数据行。
它可以指定要更新的表、列和对应的新值,以及更新的条件。
例如:```UPDATE products SET price = 10 WHERE category = 'Electronics';```上述语句将更新products表中所有category为'Electronics'的数据行的price列为10。
4. DELETE语句DELETE语句用于从数据库中删除数据行。
它可以指定要删除的表和删除的条件。
例如:```DELETE FROM orders WHERE status = 'cancelled';```上述语句将从orders表中删除所有status为'cancelled'的数据行。
5. CREATE TABLE语句CREATE TABLE语句用于创建新的数据库表。
SQL省市区三级表结构
SQL省市区三级表结构-- 表的结构 areaDROP TABLE area;CREATE TABLE area (id int NOT NULL ,areaID int NOT NULL,area varchar(200) NOT NULL,fatherID int NOT NULL,PRIMARY KEY (id))DROP TABLE city;CREATE TABLE city selectid int NOT NULL ,cityID int NOT NULL,city varcharselect 200) NOT NULL,fatherID int NOT NULL,PRIMARY KEY select id))---- 导出表中的数据 city---- ------------------------------------------------------------ 表的结构 province--DROP TABLE province;CREATE TABLE province selectid int NOT NULL ,provinceID int NOT NULL,province varcharselect 200) NOT NULL,PRIMARY KEY select id))insert province(id,provinceID,province)select 1,110000,'北京市' unionselect 2,120000,'天津市' unionselect 3,130000,'河北省' unionselect 4,140000,'⼭西省' unionselect 5,150000,'内蒙古⾃治区'unionselect 6,210000,'辽宁省' unionselect 7,220000,'吉林省' unionselect 8,230000,'⿊龙江省' unionselect 9,310000,'上海市' unionselect 10,320000,'江苏省' unionselect 11,330000,'浙江省' unionselect 12,340000,'安徽省' unionselect 13,350000,'福建省' unionselect 14,360000,'江西省' unionselect 15,370000,'⼭东省' unionselect 16,410000,'河南省' unionselect 17,420000,'湖北省' unionselect 18,430000,'湖南省' unionselect 19,440000,'⼴东省' unionselect 20,450000,'⼴西壮族⾃治区' unionselect 21,460000,'海南省' unionselect 22,500000,'重庆市' unionselect 23,510000,'四川省' unionselect 24,520000,'贵州省' unionselect 25,530000,'云南省' unionselect 26,540000,'西藏⾃治区' unionselect 27,610000,'陕西省' unionselect 28,620000,'⽢肃省' unionselect 29,630000,'青海省' unionINSERT city (id,cityID,city,fatherID)select 1,110100,'市辖区',110000 unionselect 2,110200,'县',110000 unionselect 3,120100,'市辖区',120000 unionselect 4,120200,'县',120000 unionselect 5,130100,'⽯家庄市',130000 unionselect 6,130200,'唐⼭市',130000 unionselect 7,130300,'秦皇岛市',130000 unionselect 8,130400,'邯郸市',130000 unionselect 9,130500,'邢台市',130000 unionselect 10,130600,'保定市',130000 unionselect 11,130700,'张家⼝市',130000 unionselect 12,130800,'承德市',130000 unionselect 13,130900,'沧州市',130000 unionselect 14,131000,'廊坊市',130000 unionselect 15,131100,'衡⽔市',130000 unionselect 16,140100,'太原市',140000 unionselect 17,140200,'⼤同市',140000 unionselect 18,140300,'阳泉市',140000 unionselect 19,140400,'长治市',140000 unionselect 20,140500,'晋城市',140000 unionselect 21,140600,'朔州市',140000 unionselect 22,140700,'晋中市',140000 unionselect 23,140800,'运城市',140000 unionselect 24,140900,'忻州市',140000 unionselect 25,141000,'临汾市',140000 unionselect 26,141100,'吕梁市',140000INSERT city (id,cityID,city,fatherID)select 27,150100,'呼和浩特市',150000 union select 28,150200,'包头市',150000 unionselect 29,150300,'乌海市',150000 unionselect 30,150400,'⾚峰市',150000 unionselect 31,150500,'通辽市',150000 unionselect 32,150600,'鄂尔多斯市',150000 union select 33,150700,'呼伦贝尔市',150000 union select 34,150800,'巴彦淖尔市',150000 union select 35,150900,'乌兰察布市',150000 union select 36,152200,'兴安盟',150000 unionselect 37,152500,'锡林郭勒盟',150000 union select 38,152900,'阿拉善盟',150000 unionselect 39,210100,'沈阳市',210000 unionselect 40,210200,'⼤连市',210000 unionselect 41,210300,'鞍⼭市',210000 unionselect 42,210400,'抚顺市',210000 unionselect 43,210500,'本溪市',210000 unionselect 44,210600,'丹东市',210000 unionselect 45,210700,'锦州市',210000 unionselect 46,210800,'营⼝市',210000 unionselect 47,210900,'⾩新市',210000 unionselect 48,211000,'辽阳市',210000 unionselect 49,211100,'盘锦市',210000 unionselect 50,211200,'铁岭市',210000 unionselect 51,211300,'朝阳市',210000 unionselect 52,211400,'葫芦岛市',210000 unionselect 53,220100,'长春市',220000 unionselect 54,220200,'吉林市',220000 unionselect 55,220300,'四平市',220000 unionselect 56,220400,'辽源市',220000 unionselect 57,220500,'通化市',220000 unionselect 58,220600,'⽩⼭市',220000 unionselect 59,220700,'松原市',220000 unionselect 60,220800,'⽩城市',220000 unionselect 61,222400,'延边朝鲜族⾃治州',220000 union select 62,230100,'哈尔滨市',230000 unionselect 63,230200,'齐齐哈尔市',230000 union select 64,230300,'鸡西市',230000 unionselect 65,230400,'鹤岗市',230000 unionselect 66,230500,'双鸭⼭市',230000 unionselect 74,232700,'⼤兴安岭地区',230000 union select 75,310100,'市辖区',310000 union select 76,310200,'县',310000 unionselect 77,320100,'南京市',320000 union select 78,320200,'⽆锡市',320000 union select 79,320300,'徐州市',320000 union select 80,320400,'常州市',320000 union select 81,320500,'苏州市',320000 union select 82,320600,'南通市',320000 union select 83,320700,'连云港市',320000 union select 84,320800,'淮安市',320000 union select 85,320900,'盐城市',320000 union select 86,321000,'扬州市',320000 union select 87,321100,'镇江市',320000 union select 88,321200,'泰州市',320000 union select 89,321300,'宿迁市',320000 union select 90,330100,'杭州市',330000 union select 91,330200,'宁波市',330000 union select 92,330300,'温州市',330000 union select 93,330400,'嘉兴市',330000 union select 94,330500,'湖州市',330000 union select 95,330600,'绍兴市',330000 union select 96,330700,'⾦华市',330000 union select 97,330800,'衢州市',330000 union select 98,330900,'⾈⼭市',330000 union select 99,331000,'台州市',330000 union select 100,331100,'丽⽔市',330000 union select 101,340100,'合肥市',340000 union select 102,340200,'芜湖市',340000 union select 103,340300,'蚌埠市',340000 union select 104,340400,'淮南市',340000 union select 105,340500,'马鞍⼭市',340000 union select 106,340600,'淮北市',340000 union select 107,340700,'铜陵市',340000 union select 108,340800,'安庆市',340000 union select 109,341000,'黄⼭市',340000 union select 110,341100,'滁州市',340000 union select 111,341200,'⾩阳市',340000 union select 112,341300,'宿州市',340000 union select 113,341400,'巢湖市',340000 union select 114,341500,'六安市',340000 union select 115,341600,'亳州市',340000 union select 116,341700,'池州市',340000 union select 117,341800,'宣城市',340000 union select 118,350100,'福州市',350000 union select 119,350200,'厦门市',350000 union select 120,350300,'莆⽥市',350000 union select 121,350400,'三明市',350000 union select 122,350500,'泉州市',350000 union select 123,350600,'漳州市',350000 union select 124,350700,'南平市',350000 union select 125,350800,'龙岩市',350000 union select 126,350900,'宁德市',350000INSERT city (id,cityID,city,fatherID)select 127,360100,'南昌市',360000 union select 128,360200,'景德镇市',360000 union select 129,360300,'萍乡市',360000 union select 130,360400,'九江市',360000 union select 131,360500,'新余市',360000 union select 132,360600,'鹰潭市',360000 union select 133,360700,'赣州市',360000 union select 134,360800,'吉安市',360000 union select 135,360900,'宜春市',360000 union select 136,361000,'抚州市',360000 union select 137,361100,'上饶市',360000 union select 138,370100,'济南市',370000 union select 139,370200,'青岛市',370000 unionselect 148,371100,'⽇照市',370000 unionselect 149,371200,'莱芜市',370000 unionselect 150,371300,'临沂市',370000 unionselect 151,371400,'德州市',370000 unionselect 152,371500,'聊城市',370000 unionselect 153,371600,'滨州市',370000 unionselect 154,371700,'荷泽市',370000 unionselect 155,410100,'郑州市',410000 unionselect 156,410200,'开封市',410000 unionselect 157,410300,'洛阳市',410000 unionselect 158,410400,'平顶⼭市',410000 unionselect 159,410500,'安阳市',410000 unionselect 160,410600,'鹤壁市',410000 unionselect 161,410700,'新乡市',410000 unionselect 162,410800,'焦作市',410000 unionselect 163,410900,'濮阳市',410000 unionselect 164,411000,'许昌市',410000 unionselect 165,411100,'漯河市',410000 unionselect 166,411200,'三门峡市',410000 unionselect 167,411300,'南阳市',410000 unionselect 168,411400,'商丘市',410000 unionselect 169,411500,'信阳市',410000 unionselect 170,411600,'周⼝市',410000 unionselect 171,411700,'驻马店市',410000INSERT city (id,cityID,city,fatherID)select 172,420100,'武汉市',420000 unionselect 173,420200,'黄⽯市',420000 unionselect 174,420300,'⼗堰市',420000 unionselect 175,420500,'宜昌市',420000 unionselect 176,420600,'襄樊市',420000 unionselect 177,420700,'鄂州市',420000 unionselect 178,420800,'荆门市',420000 unionselect 179,420900,'孝感市',420000 unionselect 180,421000,'荆州市',420000 unionselect 181,421100,'黄冈市',420000 unionselect 182,421200,'咸宁市',420000 unionselect 183,421300,'随州市',420000 unionselect 184,422800,'恩施⼟家族苗族⾃治州',420000 union select 185,429000,'省直辖⾏政单位',420000 union select 186,430100,'长沙市',430000 unionselect 187,430200,'株洲市',430000 unionselect 188,430300,'湘潭市',430000 unionselect 189,430400,'衡阳市',430000 unionselect 190,430500,'邵阳市',430000 unionselect 191,430600,'岳阳市',430000 unionselect 192,430700,'常德市',430000 unionselect 193,430800,'张家界市',430000 unionselect 194,430900,'益阳市',430000 unionselect 195,431000,'郴州市',430000 unionselect 196,431100,'永州市',430000 unionselect 197,431200,'怀化市',430000 unionselect 198,431300,'娄底市',430000 unionselect 199,433100,'湘西⼟家族苗族⾃治州',430000 union select 200,440100,'⼴州市',440000 unionselect 201,440200,'韶关市',440000 unionselect 202,440300,'深圳市',440000 unionselect 203,440400,'珠海市',440000 unionselect 204,440500,'汕头市',440000 unionselect 205,440600,'佛⼭市',440000 unionselect 206,440700,'江门市',440000 unionselect 207,440800,'湛江市',440000 unionselect 208,440900,'茂名市',440000 unionselect 209,441200,'肇庆市',440000 unionselect 210,441300,'惠州市',440000 unionselect 211,441400,'梅州市',440000 unionselect 220,445300,'云浮市',440000 unionselect 221,450100,'南宁市',450000 unionselect 222,450200,'柳州市',450000 unionselect 223,450300,'桂林市',450000 unionselect 224,450400,'梧州市',450000 unionselect 225,450500,'北海市',450000INSERT city (id,cityID,city,fatherID)select 226,450600,'防城港市',450000 unionselect 227,450700,'钦州市',450000 unionselect 228,450800,'贵港市',450000 unionselect 229,450900,'⽟林市',450000 unionselect 230,451000,'百⾊市',450000 unionselect 231,451100,'贺州市',450000 unionselect 232,451200,'河池市',450000 unionselect 233,451300,'来宾市',450000 unionselect 234,451400,'崇左市',450000 unionselect 235,460100,'海⼝市',460000 unionselect 236,460200,'三亚市',460000 unionselect 237,469000,'省直辖县级⾏政单位',460000 union select 238,500100,'市辖区',500000 unionselect 239,500200,'县',500000 unionselect 240,500300,'市',500000 unionselect 241,510100,'成都市',510000 unionselect 242,510300,'⾃贡市',510000 unionselect 243,510400,'攀枝花市',510000 unionselect 244,510500,'泸州市',510000 unionselect 245,510600,'德阳市',510000 unionselect 246,510700,'绵阳市',510000 unionselect 247,510800,'⼴元市',510000 unionselect 248,510900,'遂宁市',510000 unionselect 249,511000,'内江市',510000 unionselect 250,511100,'乐⼭市',510000 unionselect 251,511300,'南充市',510000 unionselect 252,511400,'眉⼭市',510000 unionselect 253,511500,'宜宾市',510000 unionselect 254,511600,'⼴安市',510000 unionselect 255,511700,'达州市',510000 unionselect 256,511800,'雅安市',510000 unionselect 257,511900,'巴中市',510000 unionselect 258,512000,'资阳市',510000 unionselect 259,513200,'阿坝藏族羌族⾃治州',510000 union select 260,513300,'⽢孜藏族⾃治州',510000 unionselect 261,513400,'凉⼭彝族⾃治州',510000 unionselect 262,520100,'贵阳市',520000 unionselect 263,520200,'六盘⽔市',520000INSERT city (id,cityID,city,fatherID)select 264,520300,'遵义市',520000 unionselect 265,520400,'安顺市',520000 unionselect 266,522200,'铜仁地区',520000 unionselect 267,522300,'黔西南布依族苗族⾃治州',520000 union select 268,522400,'毕节地区',520000 unionselect 269,522600,'黔东南苗族侗族⾃治州',520000 union select 270,522700,'黔南布依族苗族⾃治州',520000 union select 271,530100,'昆明市',530000 unionselect 272,530300,'曲靖市',530000 unionselect 273,530400,'⽟溪市',530000 unionselect 274,530500,'保⼭市',530000 unionselect 275,530600,'昭通市',530000 unionselect 276,530700,'丽江市',530000 unionselect 277,530800,'思茅市',530000 unionselect 278,530900,'临沧市',530000 unionselect 279,532300,'楚雄彝族⾃治州',530000 unionselect 280,532500,'红河哈尼族彝族⾃治州',530000 union select 281,532600,'⽂⼭壮族苗族⾃治州',530000 union select 282,532800,'西双版纳傣族⾃治州',530000 unionselect 292,542500,'阿⾥地区',540000 unionselect 293,542600,'林芝地区',540000INSERT city (id,cityID,city,fatherID)select 294,610100,'西安市',610000 unionselect 295,610200,'铜川市',610000 unionselect 296,610300,'宝鸡市',610000 unionselect 297,610400,'咸阳市',610000 unionselect 298,610500,'渭南市',610000 unionselect 299,610600,'延安市',610000 unionselect 300,610700,'汉中市',610000 unionselect 301,610800,'榆林市',610000 unionselect 302,610900,'安康市',610000 unionselect 303,611000,'商洛市',610000 unionselect 304,620100,'兰州市',620000 unionselect 305,620200,'嘉峪关市',620000 unionselect 306,620300,'⾦昌市',620000 unionselect 307,620400,'⽩银市',620000 unionselect 308,620500,'天⽔市',620000 unionselect 309,620600,'武威市',620000 unionselect 310,620700,'张掖市',620000 unionselect 311,620800,'平凉市',620000 unionselect 312,620900,'酒泉市',620000 unionselect 313,621000,'庆阳市',620000 unionselect 314,621100,'定西市',620000 unionselect 315,621200,'陇南市',620000 unionselect 316,622900,'临夏回族⾃治州',620000 unionselect 317,623000,'⽢南藏族⾃治州',620000 unionselect 318,630100,'西宁市',630000 unionselect 319,632100,'海东地区',630000 unionselect 320,632200,'海北藏族⾃治州',630000 unionselect 321,632300,'黄南藏族⾃治州',630000 unionselect 322,632500,'海南藏族⾃治州',630000 unionselect 323,632600,'果洛藏族⾃治州',630000 unionselect 324,632700,'⽟树藏族⾃治州',630000INSERT city (id,cityID,city,fatherID)select 325,632800,'海西蒙古族藏族⾃治州',630000 union select 326,640100,'银川市',640000 unionselect 327,640200,'⽯嘴⼭市',640000 unionselect 328,640300,'吴忠市',640000 unionselect 329,640400,'固原市',640000 unionselect 330,640500,'中卫市',640000 unionselect 331,650100,'乌鲁⽊齐市',650000 unionselect 332,650200,'克拉玛依市',650000 unionselect 333,652100,'吐鲁番地区',650000 unionselect 334,652200,'哈密地区',650000 unionselect 335,652300,'昌吉回族⾃治州',650000 unionselect 336,652700,'博尔塔拉蒙古⾃治州',650000 union select 337,652800,'巴⾳郭楞蒙古⾃治州',650000 union select 338,652900,'阿克苏地区',650000INSERT city (id,cityID,city,fatherID)select 339,653000,'克孜勒苏柯尔克孜⾃治州',650000 union select 340,653100,'喀什地区',650000 unionselect 341,653200,'和⽥地区',650000 unionselect 342,654000,'伊犁哈萨克⾃治州',650000 union select 343,654200,'塔城地区',650000 unionselect 344,654300,'阿勒泰地区',650000 unionselect 345,659000,'省直辖⾏政单位',650000INSERT INTO area (id,areaID,area,fatherID)select 1,110101,'东城区',110100 unionselect 2,110102,'西城区',110100 unionselect 12,110113,'顺义区',110100 union select 13,110114,'昌平区',110100 union select 14,110115,'⼤兴区',110100 union select 15,110116,'怀柔区',110100 union select 16,110117,'平⾕区',110100 union select 17,110228,'密云县',110200 union select 18,110229,'延庆县',110200 union select 19,120101,'和平区',120100 union select 20,120102,'河东区',120100 union select 21,120103,'河西区',120100 union select 22,120104,'南开区',120100 union select 23,120105,'河北区',120100 union select 24,120106,'红桥区',120100 union select 25,120107,'塘沽区',120100 union select 26,120108,'汉沽区',120100 union select 27,120109,'⼤港区',120100 union select 28,120110,'东丽区',120100 union select 29,120111,'西青区',120100 union select 30,120112,'津南区',120100 union select 31,120113,'北⾠区',120100 union select 32,120114,'武清区',120100 union select 33,120115,'宝坻区',120100 union select 34,120221,'宁河县',120200 union select 35,120223,'静海县',120200 union select 36,120225,'蓟 县',120200 union select 37,130101,'市辖区',130100 union select 38,130102,'长安区',130100 union select 39,130103,'桥东区',130100 union select 40,130104,'桥西区',130100 union select 41,130105,'新华区',130100 union select 42,130107,'井陉矿区',130100 union select 43,130108,'裕华区',130100 union select 44,130121,'井陉县',130100 union select 45,130123,'正定县',130100 union select 46,130124,'栾城县',130100 union select 47,130125,'⾏唐县',130100 union select 48,130126,'灵寿县',130100 union select 49,130127,'⾼⾢县',130100 union select 50,130128,'深泽县',130100 union select 51,130129,'赞皇县',130100 union select 52,130130,'⽆极县',130100 union select 53,130131,'平⼭县',130100 union select 54,130132,'元⽒县',130100 union select 55,130133,'赵 县',130100 union select 56,130181,'⾟集市',130100 union select 57,130182,'藁城市',130100 union select 58,130183,'晋州市',130100 union select 59,130184,'新乐市',130100 union select 60,130185,'⿅泉市',130100 union select 61,130201,'市辖区',130200 union select 62,130202,'路南区',130200 union select 63,130203,'路北区',130200 union select 64,130204,'古冶区',130200 union select 65,130205,'开平区',130200 union select 66,130207,'丰南区',130200 union select 67,130208,'丰润区',130200 union select 68,130223,'滦 县',130200 union select 69,130224,'滦南县',130200 union select 70,130225,'乐亭县',130200 union select 71,130227,'迁西县',130200 union select 72,130229,'⽟⽥县',130200 union select 73,130230,'唐海县',130200 union select 74,130281,'遵化市',130200 union select 75,130283,'迁安市',130200 union select 76,130301,'市辖区',130300 union select 77,130302,'海港区',130300 unionselect 87,130404,'复兴区',130400 union select 88,130406,'峰峰矿区',130400 union select 89,130421,'邯郸县',130400 union select 90,130423,'临漳县',130400 union select 91,130424,'成安县',130400 union select 92,130425,'⼤名县',130400 union select 93,130426,'涉 县',130400 union select 94,130427,'磁 县',130400 union select 95,130428,'肥乡县',130400 union select 96,130429,'永年县',130400 union select 97,130430,'邱 县',130400 union select 98,130431,'鸡泽县',130400 union select 99,130432,'⼴平县',130400 union select 100,130433,'馆陶县',130400 union select 101,130434,'魏 县',130400 union select 102,130435,'曲周县',130400 union select 103,130481,'武安市',130400 union select 104,130501,'市辖区',130500 union select 105,130502,'桥东区',130500 union select 106,130503,'桥西区',130500 union select 107,130521,'邢台县',130500 union select 108,130522,'临城县',130500 union select 109,130523,'内丘县',130500 union select 110,130524,'柏乡县',130500 union select 111,130525,'隆尧县',130500 union select 112,130526,'任 县',130500 union select 113,130527,'南和县',130500 union select 114,130528,'宁晋县',130500 union select 115,130529,'巨⿅县',130500 union select 116,130530,'新河县',130500 union select 117,130531,'⼴宗县',130500 union select 118,130532,'平乡县',130500 union select 119,130533,'威 县',130500 union select 120,130534,'清河县',130500 union select 121,130535,'临西县',130500 union select 122,130581,'南宫市',130500 union select 123,130582,'沙河市',130500 union select 124,130601,'市辖区',130600 union select 125,130602,'新市区',130600 union select 126,130603,'北市区',130600 union select 127,130604,'南市区',130600 union select 128,130621,'满城县',130600 union select 129,130622,'清苑县',130600 union select 130,130623,'涞⽔县',130600 union select 131,130624,'⾩平县',130600 union select 132,130625,'徐⽔县',130600 union select 133,130626,'定兴县',130600 union select 134,130627,'唐 县',130600 union select 135,130628,'⾼阳县',130600 union select 136,130629,'容城县',130600 union select 137,130630,'涞源县',130600 union select 138,130631,'望都县',130600 union select 139,130632,'安新县',130600 union select 140,130633,'易 县',130600 union select 141,130634,'曲阳县',130600 union select 142,130635,'蠡 县',130600 union select 143,130636,'顺平县',130600 union select 144,130637,'博野县',130600 union select 145,130638,'雄 县',130600 union select 146,130681,'涿州市',130600 union select 147,130682,'定州市',130600 union select 148,130683,'安国市',130600 union select 149,130684,'⾼碑店市',130600 union select 150,130701,'市辖区',130700 union select 151,130702,'桥东区',130700 union select 152,130703,'桥西区',130700 unionselect 162,130728,'怀安县',130700 unionselect 163,130729,'万全县',130700 unionselect 164,130730,'怀来县',130700 unionselect 165,130731,'涿⿅县',130700 unionselect 166,130732,'⾚城县',130700 unionselect 167,130733,'崇礼县',130700 unionselect 168,130801,'市辖区',130800 unionselect 169,130802,'双桥区',130800 unionselect 170,130803,'双滦区',130800 unionselect 171,130804,'鹰⼿营⼦矿区',130800 unionselect 172,130821,'承德县',130800 unionselect 173,130822,'兴隆县',130800 unionselect 174,130823,'平泉县',130800 unionselect 175,130824,'滦平县',130800 unionselect 176,130825,'隆化县',130800 unionselect 177,130826,'丰宁满族⾃治县',130800 union select 178,130827,'宽城满族⾃治县',130800 union select 179,130828,'围场满族蒙古族⾃治县',130800 union select 180,130901,'市辖区',130900 unionselect 181,130902,'新华区',130900 unionselect 182,130903,'运河区',130900 unionselect 183,130921,'沧 县',130900 unionselect 184,130922,'青 县',130900 unionselect 185,130923,'东光县',130900 unionselect 186,130924,'海兴县',130900 unionselect 187,130925,'盐⼭县',130900 unionselect 188,130926,'肃宁县',130900 unionselect 189,130927,'南⽪县',130900 unionselect 190,130928,'吴桥县',130900 unionselect 191,130929,'献 县',130900 unionselect 192,130930,'孟村回族⾃治县',130900 union select 193,130981,'泊头市',130900 unionselect 194,130982,'任丘市',130900 unionselect 195,130983,'黄骅市',130900 unionselect 196,130984,'河间市',130900 unionselect 197,131001,'市辖区',131000 unionselect 198,131002,'安次区',131000 unionselect 199,131003,'⼴阳区',131000 unionselect 200,131022,'固安县',131000 unionselect 201,131023,'永清县',131000 unionselect 202,131024,'⾹河县',131000 unionselect 203,131025,'⼤城县',131000 unionselect 204,131026,'⽂安县',131000 unionselect 205,131028,'⼤⼚回族⾃治县',131000 union select 206,131081,'霸州市',131000 unionselect 207,131082,'三河市',131000 unionselect 208,131101,'市辖区',131100 unionselect 209,131102,'桃城区',131100 unionselect 210,131121,'枣强县',131100 unionselect 211,131122,'武⾢县',131100 unionselect 212,131123,'武强县',131100 unionselect 213,131124,'饶阳县',131100 unionselect 214,131125,'安平县',131100 unionselect 215,131126,'故城县',131100 unionselect 216,131127,'景 县',131100 unionselect 217,131128,'⾩城县',131100 unionselect 218,131181,'冀州市',131100 unionselect 219,131182,'深州市',131100 unionselect 220,140101,'市辖区',140100 unionselect 221,140105,'⼩店区',140100 unionselect 222,140106,'迎泽区',140100 unionselect 223,140107,'杏花岭区',140100 unionselect 224,140108,'尖草坪区',140100 unionselect 225,140109,'万柏林区',140100 unionselect 226,140110,'晋源区',140100 unionselect 227,140121,'清徐县',140100 unionselect 228,140122,'阳曲县',140100 unionselect 233,140203,'矿 区',140200 union select 234,140211,'南郊区',140200 union select 235,140212,'新荣区',140200 union select 236,140221,'阳⾼县',140200 union select 237,140222,'天镇县',140200 union select 238,140223,'⼴灵县',140200 union select 239,140224,'灵丘县',140200 union select 240,140225,'浑源县',140200 union select 241,140226,'左云县',140200 union select 242,140227,'⼤同县',140200 union select 243,140301,'市辖区',140300 union select 244,140302,'城 区',140300 union select 245,140303,'矿 区',140300 union select 246,140311,'郊 区',140300 union select 247,140321,'平定县',140300 union select 248,140322,'盂 县',140300 union select 249,140401,'市辖区',140400 union select 250,140402,'城 区',140400 union select 251,140411,'郊 区',140400 union select 252,140421,'长治县',140400 union select 253,140423,'襄垣县',140400 union select 254,140424,'屯留县',140400 union select 255,140425,'平顺县',140400 union select 256,140426,'黎城县',140400 union select 257,140427,'壶关县',140400 union select 258,140428,'长⼦县',140400 union select 259,140429,'武乡县',140400 union select 260,140430,'沁 县',140400 union select 261,140431,'沁源县',140400 union select 262,140481,'潞城市',140400 union select 263,140501,'市辖区',140500 union select 264,140502,'城 区',140500 union select 265,140521,'沁⽔县',140500 union select 266,140522,'阳城县',140500 union select 267,140524,'陵川县',140500 union select 268,140525,'泽州县',140500 union select 269,140581,'⾼平市',140500 union select 270,140601,'市辖区',140600 union select 271,140602,'朔城区',140600 union select 272,140603,'平鲁区',140600 union select 273,140621,'⼭阴县',140600 union select 274,140622,'应 县',140600 union select 275,140623,'右⽟县',140600 union select 276,140624,'怀仁县',140600 union select 277,140701,'市辖区',140700 union select 278,140702,'榆次区',140700 union select 279,140721,'榆社县',140700 union select 280,140722,'左权县',140700 union select 281,140723,'和顺县',140700 union select 282,140724,'昔阳县',140700 union select 283,140725,'寿阳县',140700 union select 284,140726,'太⾕县',140700 union select 285,140727,'祁 县',140700 union select 286,140728,'平遥县',140700 union select 287,140729,'灵⽯县',140700 union select 288,140781,'介休市',140700 union select 289,140801,'市辖区',140800 union select 290,140802,'盐湖区',140800 union select 291,140821,'临猗县',140800 union select 292,140822,'万荣县',140800 union select 293,140823,'闻喜县',140800 union select 294,140824,'稷⼭县',140800 union select 295,140825,'新绛县',140800 union select 296,140826,'绛 县',140800 union select 297,140827,'垣曲县',140800 union select 298,140828,'夏 县',140800 union select 299,140829,'平陆县',140800 union select 300,140830,'芮城县',140800 union select 301,140881,'永济市',140800 union select 302,140882,'河津市',140800 union select 303,140901,'市辖区',140900 union。
sql命令语句
sql命令语句嘿,朋友!你知道 SQL 命令语句吗?这玩意儿可太重要啦!就好比是一把神奇的钥匙,能打开数据库那神秘宝库的大门。
比如说,当你想要从一个超级大的数据库里找出特定的信息,这时候 SQL 的 SELECT 语句就派上用场啦!“SELECT * FROM table_name”,就像你在茫茫人海中精准地找到你要找的那个人一样神奇!你能想象没有它该怎么办吗?还有啊,INSERT 语句,那简直就是给数据库添加新东西的魔法棒呀!“INSERT INTO table_name (column1, column2, column3) VALUES (value1, value2, value3)”,这不就像是给一个空房间里添置新家具嘛,一下子就让它丰富起来了。
UPDATE 语句呢,就像是给已有的东西做个小改造,让它更符合你的需求。
“UPDATE table_name SET column1 = value1 WHERE condition”,这多像给一件衣服换个扣子或者改个颜色呀!DELETE 语句,哎呀,这可有点厉害咯!它就像是把不需要的东西直接清理掉。
“DELETE FROM table_name WHERE condition”,这就像你清理房间时扔掉那些没用的杂物一样果断。
我之前和一个朋友一起做项目,他对 SQL 命令语句不太熟悉,结果在处理数据的时候那叫一个手忙脚乱啊!我就跟他说:“嘿,你得好好学学 SQL 命令语句呀,不然这工作可没法干啦!”他还不信,后来吃了不少苦头才意识到重要性。
SQL 命令语句真的是太实用啦!它是我们和数据库沟通的桥梁,没有它,我们怎么能在数据的海洋里畅游呢?所以呀,一定要好好掌握它,让它为我们的工作和生活带来便利!这就是我的观点,SQL 命令语句,不可或缺!。
简单的sql查询语句
简单的sql查询语句
SQL是一种结构化查询语言,用于管理关系型数据库。
以下是一些简单的SQL查询语句:
1. SELECT语句:用于从数据库中检索数据。
例如,SELECT * FROM table_name; 将返回表'table_name'中的所有数据。
2. WHERE语句:用于筛选查询结果,只返回符合特定条件的数据。
例如,SELECT * FROM table_name WHERE column_name = 'value'; 将只返回值为'value'的行。
3. ORDER BY语句:用于按特定列的值对查询结果进行排序。
例如,SELECT * FROM table_name ORDER BY column_name ASC; 将按升序排列该列的值。
4. LIMIT语句:用于限制返回的行数。
例如,SELECT * FROM table_name LIMIT 10; 将只返回前10行的数据。
5. GROUP BY语句:用于根据特定列的值对查询结果进行分组。
例如,SELECT column_name, COUNT(*) FROM table_name GROUP BY column_name; 将返回每个不同值的行数。
以上是一些简单的SQL查询语句,应用广泛且易于理解。
在使用时,应注意保持查询语句的简洁性和可读性,以便更好地管理和维护数据库。
- 1 -。
sql语句大全
sql语句大全SQL语句大全。
SQL(Structured Query Language)是一种专门用来管理关系数据库管理系统(RDBMS)的语言,它可以用来执行各种数据库操作,包括查询、插入、更新、删除等。
在数据库开发和管理中,熟练掌握SQL语句是非常重要的,因为它是与数据库打交道的基础。
本文将为大家详细介绍SQL语句的各种用法,希望能为大家的数据库开发和管理工作提供帮助。
1. 创建数据库。
在SQL中,我们可以使用CREATE DATABASE语句来创建一个新的数据库。
语法如下:```sql。
CREATE DATABASE database_name;```。
其中,database_name是要创建的数据库的名称。
2. 删除数据库。
如果需要删除一个数据库,可以使用DROP DATABASE语句。
语法如下:```sql。
DROP DATABASE database_name;```。
这将会删除指定的数据库及其中的所有表和数据,所以在使用时要格外小心。
3. 创建表。
在数据库中,表是用来存储数据的基本单位。
我们可以使用CREATE TABLE 语句来创建一个新的表。
语法如下:```sql。
CREATE TABLE table_name (。
column1 datatype,。
column2 datatype,。
column3 datatype,。
...);```。
其中,table_name是要创建的表的名称,column1、column2等是表中的列名,datatype是列的数据类型。
4. 删除表。
如果需要删除一个表,可以使用DROP TABLE语句。
语法如下:```sql。
DROP TABLE table_name;```。
这将会删除指定的表及其中的所有数据,所以也要格外小心使用。
5. 插入数据。
在已有的表中插入数据,可以使用INSERT INTO语句。
语法如下:```sql。
INSERT INTO table_name (column1, column2, column3, ...)。
sql查询语句格式
sql查询语句格式
SQL(Structured Query Language)是用于管理关系数据库的标准编程语言。
以下是SQL查询语句的基本格式:
sql复制代码
SELECT列1, 列2, ...
FROM表名
WHERE条件
ORDER BY列1 [ASC|DESC], 列2
[ASC|DESC], ...;
解释:
•SELECT:用于指定要查询的列。
可以指定一个或多个列,用逗号分隔。
•FROM:指定要查询的表名。
•WHERE:用于设置查询条件,筛选符合条件的记录。
可以指定一个或多个条件,用逻辑运算符(如AND、OR)连接。
•ORDER BY:用于对查询结果进行排序。
可以按照一个或多个列进行排序,默认为升序(ASC),
也可以指定降序(DESC)。
以下是一个示例查询语句,从名为"employees"的表中选取所有员工的姓名和工资,并按照工资降序排列:
sql复制代码
SELECT first_name, last_name,
salary
FROM employees
ORDER BY salary DESC;
这只是一个简单的示例,实际的SQL查询语句可能根据具体需求和数据库结构有所不同。
数据库基本SQL语句大全
数据库基本_SQL语句大全学会数据库是很实用D~~记录一些常用的sql语句...有入门有提高有见都没见过的...好全...收藏下...其实一般用的就是查询,插入,删除等语句而已....但学学存储过程是好事...以后数据方面的东西就不用在程序里搞喽..而且程序与数据库只要一个来回通讯就可以搞定所有数据的操作....一、基础1、说明:创建数据库Create DATABASE database-name2、说明:删除数据库drop database dbname3、说明:备份sql server--- 创建备份数据的deviceUSE masterEXEC sp_addumpdevice ‘disk‘, ‘testBack‘, ‘c:\mssql7backup\‘--- 开始备份BACKUP DATABASE pubs TO testBack4、说明:创建新表create table tabnamecol1 type1 not null primary key,col2 type2 not null,..根据已有的表创建新表:A:create table tab_new like tab_old 使用旧表创建新表B:create table tab_new as select col1,col2… from tab_old definition only 5、说明:删除新表drop table tabname6、说明:增加一个列Alter table tabname add column col type注:列增加后将不能删除;DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度;7、说明:添加主键:Alter table tabname add primary keycol说明:删除主键:Alter table tabname drop primary keycol8、说明:创建索引:create unique index idxname on tabnamecol….删除索引:drop index idxname注:索引是不可更改的,想更改必须删除重新建;9、说明:创建视图:create view viewname as select statement删除视图:drop view viewname10、说明:几个简单的基本的sql语句选择:select from table1 where 范围插入:insert into table1field1,field2 valuesvalue1,value2删除:delete from table1 where 范围更新:update table1 set field1=value1 where 范围查找:select from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料排序:select from table1 order by field1,field2 desc总数:select count as totalcount from table1求和:select sumfield1 as sumvalue from table1平均:select avgfield1 as avgvalue from table1最大:select maxfield1 as maxvalue from table1最小:select minfield1 as minvalue from table111、说明:几个高级查询运算词A:UNION 运算符UNION 运算符通过组合其他两个结果表例如TABLE1 和TABLE2并消去表中任何重复行而派生出一个结果表;当ALL 随UNION 一起使用时即UNION ALL,不消除重复行;两种情况下,派生表的每一行不是来自TABLE1 就是来自TABLE2;B:EXCEPT 运算符EXCEPT 运算符通过包括所有在TABLE1 中但不在TABLE2 中的行并消除所有重复行而派生出一个结果表;当ALL 随EXCEPT 一起使用时EXCEPT ALL,不消除重复行;C:INTERSECT 运算符INTERSECT 运算符通过只包括TABLE1 和TABLE2 中都有的行并消除所有重复行而派生出一个结果表;当ALL 随INTERSECT 一起使用时INTERSECT ALL,不消除重复行;注:使用运算词的几个查询结果行必须是一致的;12、说明:使用外连接A、left outer join:左外连接左连接:结果集几包括连接表的匹配行,也包括左连接表的所有行;SQL: select , , , , , from a LEFT OUT JOIN b ON =B:right outer join:右外连接右连接:结果集既包括连接表的匹配连接行,也包括右连接表的所有行;C:full outer join:全外连接:不仅包括符号连接表的匹配行,还包括两个连接表中的所有记录;二、提升1、说明:复制表只复制结构,源表名:a 新表名:b Access可用法一:select into b from a where 1<>1法二:select top 0 into b from a2、说明:拷贝表拷贝数据,源表名:a 目标表名:b Access可用insert into ba, b, c select d,e,f from b;3、说明:跨数据库之间表的拷贝具体数据使用绝对路径Access可用insert into ba, b, c select d,e,f from b in ‘具体数据库’ where 条件例子:..from b in ‘"&"."&"\" &"‘ where..4、说明:子查询表名1:a 表名2:bselect a,b,c from a where a IN select d from b 或者: select a,b,c from a where a IN 1,2,35、说明:显示文章、提交人和最后回复时间select ,, from table a,select maxadddate adddate from table where = b6、说明:外连接查询表名1:a 表名2:bselect , , , , , from a LEFT OUT JOIN b ON =7、说明:在线视图查询表名1:aselect from Select a,b,c FROM a T where > 1;8、说明:between的用法,between限制查询数据范围时包括了边界值,not between不包括select from table1 where time between time1 and time2select a,b,c, from table1 where a not between 数值1 and 数值29、说明:in 的使用方法select from table1 where a not in ‘值1’,’值2’,’值4’,’值6’10、说明:两张关联表,删除主表中已经在副表中没有的信息delete from table1 where not exists select from table2 where =11、说明:四表联查问题:select from a left inner join b on = right inner join c on = inner join d on = where .....12、说明:日程安排提前五分钟提醒SQL: select from 日程安排where datediff‘minute‘,f开始时间,getdate>513、说明:一条sql 语句搞定数据库分页select top 10 b. from select top 20 主键字段,排序字段from 表名order by 排序字段desc a,表名b where b.主键字段= a.主键字段order by a.排序字段14、说明:前10条记录select top 10 form table1 where 范围15、说明:选择在每一组b值相同的数据中对应的a最大的记录的所有信息类似这样的用法可以用于论坛每月排行榜,每月热销产品分析,按科目成绩排名,等等.select a,b,c from tablename ta where a=select maxa from tablename tb where =16、说明:包括所有在TableA 中但不在TableB和TableC 中的行并消除所有重复行而派生出一个结果表select a from tableA except select a from tableB except select a from tableC 17、说明:随机取出10条数据select top 10 from tablename order by newid18、说明:随机选择记录select newid19、说明:删除重复记录Delete from tablename where id not in select maxid from tablename group by col1,col2,...20、说明:列出数据库里所有的表名select name from sysobjects where type=‘U‘21、说明:列出表里的所有的sele ct name from syscolumns where id=object_id‘TableName‘22、说明:列示type、vender、pcs字段,以type字段排列,case可以方便地实现多重选择,类似select 中的case;select type,sumcase vender when ‘A‘ then pcs else 0 end,sumcase vender when ‘C‘ then pcs else 0 end,sumcase vender when ‘B‘ then pcs else 0 end FROM tablename group by type显示结果:type vender pcs电脑A 1电脑A 1光盘B 2光盘A 2手机B 3手机C 323、说明:初始化表table1TRUNCATE TABLE table124、说明:选择从10到15的记录select top 5 from select top 15 from table order by id asc table_别名order by id desc三、技巧1、1=1,1=2的使用,在SQL语句组合时用的较多“where 1=1” 是表示选择全部“where 1=2”全部不选,如:if strWhere =‘beginset strSQL = ‘select count as Total from ‘ + tblName + ‘ where ‘ + strWhere endelsebeginset strSQL = ‘select count as Total from ‘ + tblName + ‘‘end我们可以直接写成set strSQ L = ‘select count as Total from ‘ + tblName + ‘ where 1=1 安定‘+ strWhere2、收缩数据库--重建索引DBCC REINDEXDBCC INDEXDEFRAG--收缩数据和日志DBCC SHRINKDBDBCC SHRINKFILE3、压缩数据库dbcc shrinkdatabasedbname4、转移数据库给新用户以已存在用户权限exec sp_change_users_login ‘update_one‘,‘newname‘,‘oldname‘go5、检查备份集RESTORE VERIFYONLY from disk=‘E:\‘6、修复数据库Alter DATABASE dvbbs SET SINGLE_USERGODBCC CHECKDB‘dvbbs‘,repair_allow_data_loss WITH TABLOCKGOAlter DATABASE dvbbs SET MULTI_USERGO7、日志清除SET NOCOUNT ONDECLARE LogicalFileName sysname,MaxMinutes INT,NewSize INTUSE tablename -- 要操作的数据库名Select LogicalFileName = ‘tablename_log‘, -- 日志文件名MaxMinutes = 10, -- Limit on time allowed to wrap log.NewSize = 1 -- 你想设定的日志文件的大小M-- Setup / initializeDECLARE OriginalSize intSelect OriginalSize = sizeFROM sysfilesWhere name = LogicalFileNameSelect ‘Original Size of ‘ + db_name + ‘ LOG is ‘ + CONVERTVARCHAR30,OriginalSize + ‘ 8K pages or ‘ + CONVERTVARCHAR30,OriginalSize8/1024 + ‘MB‘FROM sysfilesWhere name = LogicalFileNameCreate TABLE DummyTransDummyColumn char 8000 not nullDECLARE Counter INT,StartTime DATETIME,TruncLog VARCHAR255Select StartTime = GETDATE,TruncLog = ‘BACKUP LOG ‘ + db_name + ‘ WITH TRUNCATE_ONLY‘DBCC SHRINKFILE LogicalFileName, NewSizeEXEC TruncLog-- Wrap the log if necessary.WHILE MaxMinutes > DATEDIFF mi, StartTime, GETDATE -- time has not expiredAND OriginalSize = Select size FROM sysfiles Where name = LogicalFileNameAND OriginalSize 8 /1024 > NewSizeBEGIN -- Outer loop.Select Counter = 0WHILE Counter < OriginalSize / 16 AND Counter < 50000 BEGIN -- updateInsert DummyTrans VALUES ‘Fill Log‘Delete DummyTransSelect Counter = Counter + 1ENDEXEC TruncLogENDSelect ‘Final Size of ‘ + db_name + ‘ LOG is ‘ + CONVERTVARCHAR30,size + ‘ 8K pages or ‘ + CONVERTVARCHAR30,size8/1024 + ‘MB‘FROM sysfilesWhere name = LogicalFileNameDrop TABLE DummyTransSET NOCOUNT OFF8、说明:更改某个表exec sp_changeobjectowner ‘tablename‘,‘dbo‘9、存储更改全部表Create PROCEDUREOldOwner as NVARCHAR128,NewOwner as NVARCHAR128ASDECLARE Name as NVARCHAR128DECLARE Owner as NVARCHAR128DECLARE OwnerName as NVARCHAR128 DECLARE curObject CURSOR FORselect ‘Name‘ = name,‘Owner‘ = user_nameuidfrom sysobjectswhere user_nameuid=OldOwnerorder by nameOPEN curObjectFETCH NEXT FROM curObject INTO Name, Owner WHILEFETCH_STATUS=0BEGINif Owner=OldOwnerbeginset OwnerName = OldOwner + ‘.‘ + rtrimNameexec sp_changeobjectowner OwnerName, NewOwnerend-- select name,NewOwner,OldOwnerFETCH NEXT FROM curObject INTO Name, Owner ENDclose curObjectdeallocate curObjectGO10、SQL SERVER中直接循环写入数据declare i intset i=1while i<30begininsert into test userid valuesiset i=i+1end。
常见sql语法结构
常见sql语法结构
常见的SQL语法结构包括:
1. SELECT语句:用于从数据库中检索数据。
语法结构为:
SELECT 列名1, 列名2, ... FROM 表名 WHERE 条件;
2. INSERT INTO语句:用于向数据库中插入新的数据。
语法结构为: INSERT INTO 表名 (列名1, 列名2, ...) VALUES (值1, 值2, ...);
3. UPDATE语句:用于更新数据库中的数据。
语法结构为:
UPDATE 表名 SET 列名1 = 值1, 列名2 = 值2, ... WHERE 条件;
4. DELETE语句:用于从数据库中删除数据。
语法结构为:
DELETE FROM 表名 WHERE 条件;
5. CREATE TABLE语句:用于创建新的数据库表。
语法结构为:
CREATE TABLE 表名 (列名1 数据类型, 列名2 数据类型, ...);
6. ALTER TABLE语句:用于修改数据库表的结构。
语法结构为:
ALTER TABLE 表名 ADD COLUMN 列名数据类型;
7. DROP TABLE语句:用于删除数据库表。
语法结构为:
DROP TABLE 表名;
8. JOIN语句:用于将多个表连接起来以检索相关数据。
语法结构为:
SELECT 列名1, 列名2, ... FROM 表名1 JOIN 表名2 ON 表名1.列名 = 表名2.列名;
这些是SQL语言中最常见的语法结构,用于进行数据库的查询、插入、更新和删除操作。
SQL结构化查询语句
SQL结构化查询语句
SQL(Structured Query Language)是用于管理关系型数据库的标准化语言。
它包含了各种结构化查询语句,用于执行数据库操作。
常见的结构化查询语句包括:
1.SELECT语句:用于从数据库中检索数据。
例如:SELECT*FROM表名;
2.INSERT语句:用于向数据库中插入新的数据。
例如:INSERTINTO表名(列1,列2)VALUES(值1,值2);
3.UPDATE语句:用于更新数据库中的数据。
例如:UPDATE表名SET列名=值WHERE条件;
4.DELETE语句:用于删除数据库中的数据。
例如:DELETEFROM表名WHERE条件;
5.CREATETABLE语句:用于创建表格。
例如:CREATETABLE表名(列1数据类型,列2数据类型,...);
6.ALTERTABLE语句:用于修改表格结构。
例如:ALTERTABLE表名ADD列名数据类型;
7.DROPTABLE语句:用于删除表格。
例如:DROPTABLE表名;
这些是SQL中的常见结构化查询语句,通过使用这些语句可以对数据库进行增删改查等操作。
不同的数据库管理系统可能会稍有差异,但基本的语法和功能是相似的。
sql命令的语法格式
SQL命令的语法格式SQL(Structured Query Language)是用于管理关系型数据库的标准语言。
在使用SQL命令进行数据库操作时,了解其语法格式对于正确有效地执行命令至关重要。
本文将介绍SQL命令的语法格式,包括数据查询、数据插入、数据更新和数据删除等常见命令。
1. 数据查询数据查询是SQL中最常见的操作之一。
以下是查询命令的语法格式:SELECT 列名FROM 表名WHERE 条件;其中,关键字SELECT表示要查询的数据列,FROM指定要查询的数据表,WHERE用于设置查询条件。
示例1:查询指定表的所有列SELECT *FROM 表名;示例2:查询指定表中满足某个条件的行SELECT 列名FROM 表名WHERE 条件;2. 数据插入数据插入用于向数据库中的表中添加新的数据。
以下是插入命令的语法格式:INSERT INTO 表名 (列1, 列2, 列3, ...)VALUES (值1, 值2, 值3, ...);其中,关键字INSERT INTO指定要插入数据的表名,括号内的列名表示要插入数据的列,VALUES后面的括号内为对应列的具体值。
示例:向表中插入一条记录INSERT INTO 表名 (列1, 列2, 列3)VALUES (值1, 值2, 值3);3. 数据更新数据更新用于修改已存在的数据库中的数据。
以下是更新命令的语法格式:UPDATE 表名SET 列名1 = 值1, 列名2 = 值2, ...WHERE 条件;其中,关键字UPDATE指定要更新数据的表名,SET用于指定要更新的列及其对应的新值,WHERE用于设置更新的条件。
示例:更新表中满足某个条件的行的数据UPDATE 表名SET 列名1 = 新值1, 列名2 = 新值2, ...WHERE 条件;4. 数据删除数据删除用于从数据库中删除指定的数据。
以下是删除命令的语法格式:DELETE FROM 表名WHERE 条件;其中,关键字DELETE FROM指定要删除数据的表名,WHERE用于设置删除的条件。
查询sql数据结构sql语句
查询sql数据结构sql语句此查询数据结构的语句是本BLOG中的数据库帮助⼯具的关键...由于 sql2000与sql2005的系统表名不同, 查询的字符串都不同,分别如下.....sql2000SELECTColumn_id = c.colid,ColumnName = ,PrimaryKey =CASE WHENEXISTS(SELECT0FROM sysindexkeys i WHERE i.id = c.id and i.colid = c.colid)THEN N'√'ELSE N''END,[IDENTITY]=CASEWHEN C.colstat=1THEN N'IDENTITY ( '+RTRIM(IDENT_SEED())+N' , '+RTRIM(IDENT_INCR())+N' )'ELSE N''END,Computed=CASE WHEN C.iscomputed=1THEN N'√'ELSE N''END,type = ,Length = c.length,[Precision]= c.prec,Scale = C.scale,NullAble =CASE WHEN C.isnullable =1THEN N'√'ELSE N''END,[Default]=ISNULL(CASE WHEN c.cdefault >0THEN( SELECT[text]FROM syscomments WHERE id = c.cdefault )END,N''),ColumnDesc =CASE WHENEXISTS(SELECT[value]FROM sysproperties s WHERE s.id = c.id AND c.colid = s.smallid)THEN (SELECT[value]FROM sysproperties s WHERE s.id = c.id AND c.colid = s.smallid) ELSE''ENDFROM syscolumns c, sysobjects o, systypes tWHERE c.id = o.id AND = {0} AND t.xtype = c.xtype order by c.Column_idsql2005:SELECTColumn_id=C.column_id,ColumnName=,PrimaryKey=ISNULL(IDX.PrimaryKey,N''),[IDENTITY]=CASEWHEN C.is_identity=1THEN N'IDENTITY ( '+RTRIM(IDENT_SEED())+N' , '+RTRIM(IDENT_INCR())+N' )'ELSE N''END,Computed=CASE WHEN C.is_computed=1THEN N'√'ELSE N''END,Type=,Length=C.max_length,Precision=C.precision,Scale=C.scale,NullAble=CASE WHEN C.is_nullable=1THEN N'√'ELSE N''END,[Default]=ISNULL(D.definition,N''),ColumnDesc=ISNULL(PFD.[value],N'')--,IndexName=ISNULL(IDX.IndexName,N''),--IndexSort=ISNULL(IDX.Sort,N''),-- Create_Date=O.Create_Date,--Modify_Date=O.Modify_dateFROM sys.columns CINNER JOIN sys.objects OON C.[object_id]=O.[object_id]AND O.type='U'AND O.is_ms_shipped=0INNER JOIN sys.types TON er_type_id=er_type_idLEFT JOIN sys.default_constraints DON C.[object_id]=D.parent_object_idAND C.column_id=D.parent_column_idAND C.default_object_id=D.[object_id]LEFT JOIN sys.extended_properties PFDON PFD.class=1AND C.[object_id]=PFD.major_idAND C.column_id=PFD.minor_id-- AND ='Caption' -- 字段说明对应的描述名称(⼀个字段可以添加多个不同name的描述)LEFT JOIN sys.extended_properties PTBON PTB.class=1AND PTB.minor_id=0AND C.[object_id]=PTB.major_id-- AND ='Caption' -- 表说明对应的描述名称(⼀个表可以添加多个不同name的描述)LEFT JOIN-- 索引及主键信息(SELECTIDXC.[object_id],IDXC.column_id,Sort=CASE INDEXKEY_PROPERTY(IDXC.[object_id],IDXC.index_id,IDXC.index_column_id,'IsDescending')WHEN1THEN'DESC'WHEN0THEN'ASC'ELSE''END,PrimaryKey=CASE WHEN IDX.is_primary_key=1THEN N'√'ELSE N''END,IndexName=FROM sys.indexes IDXINNER JOIN sys.index_columns IDXCON IDX.[object_id]=IDXC.[object_id]AND IDX.index_id=IDXC.index_idLEFT JOIN sys.key_constraints KCON IDX.[object_id]=KC.[parent_object_id]AND IDX.index_id=KC.unique_index_idINNER JOIN-- 对于⼀个列包含多个索引的情况,只显⽰第1个索引信息(SELECT[object_id], Column_id, index_id=MIN(index_id)FROM sys.index_columnsGROUP BY[object_id], Column_id) IDXCUQON IDXC.[object_id]=IDXCUQ.[object_id]AND IDXC.Column_id=IDXCUQ.Column_idAND IDXC.index_id=IDXCUQ.index_id) IDXON C.[object_id]=IDX.[object_id]AND C.column_id=IDX.column_idWHERE = {0} -- 如果只查询指定表,加上此条件ORDER BY ,C.column_id{0} 的字符串应该替换为相应的数据库名....。
sql语句结构
sql语句结构
SQL语句的一般结构分为以下几个部分:
1. SELECT语句:选择需要查询的数据列,可以使用聚合函数(SUM、AVG、COUNT等)对数据进行统计处理。
2. FROM语句:指定需要查询的数据表,也可以包括多个表,使用JOIN语句进行连接。
3. WHERE语句:对查询的数据进行筛选,选择符合条件的数据行,可以使用运算符、逻辑运算符和关键字等进行判断。
4. GROUP BY语句:对查询的数据进行分组,按照指定的列对数据进行分组,通常与聚合函数一起使用。
5. ORDER BY语句:对查询的结果进行排序,按照指定的列进行升序或降序排列。
6. LIMIT语句:限制查询结果的数量,只取前n条符合条件的数据。
sql的包含语句
sql的包含语句
SQL全称 (Structure Query Language)是数据库操作的的核心语言.
SQL语句包含:
1.DDL(Data Definition Languages)语句:即数据库定义语句,用来创建数据库中的表、索引、视图、存储过程、触发器等,常用的语句关键字有:CREATE,ALTER,DROP,TRUNCATE,COMMENT,RENAME。
2. DML(Data Manipulation Language)语句:即数据操纵语句,用来查询、添加、更新、删除等,常用的语句关键字有:SELECT,INSERT,UPDATE,DELETE,MERGE,CALL,EXPLAIN PLAN,LOCK TABLE,包括通用性的增删改查。
3. DCL(Data Control Language)语句:即数据控制语句,用于授权/撤销数据库及其字段的权限(DCL is short name of Data Control Language which includes commands such as GRANT and mostly concerned with rights, permissions and other controls of the database system.)。
常用的语句关键字有:GRANT,REVOKE。
4. TCL(Transaction Control Language)语句:事务控制语句,用于控制事务,常用的语句关键字有:COMMIT,ROLLBACK,SAVEPOINT,SET TRANSACTION。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
**************************************************************************/ 表空间CODE 用户CUSER/***************************************************************************/CREATE TABLE CUSER.purview(pid number(16,0) not null,loginid Varchar(10),password Varchar(16),property Varchar(1),storeid Varchar(6),11super varchar(1),username Varchar(10),rid Varchar(6),constraint pk_purview PRIMARY KEY ( pid )) TABLESPACE CODE ;CREATE TABLE CUSER.REGION(rid varchar(6) not null,sname varchar(50),allame varchar(50),serial number(4,0),constraint pk_REGION PRIMARY KEY ( rid )) TABLESPACE CODE ;CREATE TABLE CUSER.mstorage (Sid varchar(6) not null,owner varchar(2) ,constraint ckc_owner_store check (owner in ('01','02','03','04')),serial number(4,0),name varchar(48),simple varchar(14) ,rid varchar(6) ,constraint pk_mstorage PRIMARY KEY(sid)) TABLESPACE CODE;CREATE TABLE CUSER.storeinfo(sid varchar(6) not null,area number(16, 4),picture varchar(16),dutyman varchar(16),tel varchar(12),postal varchar(6),email varchar(30),facsimile varchar(12),summarize varchar(36),note varchar(255),PICNAME varchar(100),constraint pk_storeinfo PRIMARY KEY ( sid ) ) TABLESPACE CODE;CREATE TABLE CUSER.msort(mid varchar(4) not null, name varchar(48),sid varchar(4),measure varchar(12),serial number(4,0),conv varchar(12),convalue float,supname varchar(4),term number(3,0),constraint pk_msort PRIMARY KEY ( mid ) ) TABLESPACE CODE;CREATE TABLE CUSER.specs(sid varchar(12) not null,name varchar(16),mid varchar(12),serial number(4,0),constraint pk_specs PRIMARY KEY ( sid ) ) TABLESPACE CODE;CREATE TABLE CUSER.module(mid varchar(10) not null, name varchar(30),flag varchar(5),constraint pk_module PRIMARY KEY ( mid ) ) TABLESPACE CODE;CREATE TABLE CUSER.oitem(PID NUMBER(16) not null,MID VARCHAR2(10) not null,pbrowse varchar(1) default 0,psearch varchar(1) default 0,padd varchar(1) default 0,pmod varchar(1) default 0,pdel varchar(1) default 0,paud varchar(1) default 0,pprint varchar(1) default 0,pfile varchar(1) default 0,constraint pk_oitem PRIMARY KEY ( pid, mid)) TABLESPACE CODE;CREATE TABLE CUSER.oitemsort(osid varchar(16) not null,osort varchar(30),constraint pk_oitemsort PRIMARY KEY ( osid )) TABLESPACE CODE;CREATE TABLE CUSER.DEPARTMENT (D_ID1 NUMBER(16) NOT NULL,D_ID2 NUMBER(16) NOT NULL,O_ID VARCHAR2(24) NOT NULL,NAME VARCHAR2(24),TEL VARCHAR2(16),ZIP VARCHAR2(6),ADDR VARCHAR2(18),WA VARCHAR2(12),FAX VARCHAR2(12),EMAIL VARCHAR2(30),MEM VARCHAR2(255),CONSTRAINT PK_DEPARTMENT PRIMARY KEY(D_ID1, D_ID2)) TABLESPACE CODE;CREATE TABLE CUSER.office (O_ID int not null,name varchar(48) null,addr varchar(48) null,zip varchar(6) null,RID varchar(6) null,tel varchar(48) null,wav varchar(16) null,fax varchar(16) null,email varchar(48) null,mem varchar(255) null,constraint pk_office PRIMARY KEY (O_ID) ) TABLESPACE CODE;CREATE TABLE CUSER.person(num int not null,O_ID int not null,D_ID1 int ,D_ID2 int ,name varchar(24) ,job varchar(12) ,addr varchar(48) ,mobile varchar(16) ,call varchar(16) ,wav varchar(16) ,zip varchar(6) ,offtel varchar(16) ,famtel varchar(16) ,fax varchar(16) null,email varchar(16) ,mem varchar(255) ,constraint pk_person PRIMARY KEY (num ) ) TABLESPACE CODE;CREATE TABLE CUSER.criteriatype (type int not null,typename varchar(14) not null,constraint pk_criteriatype PRIMARY KEY (type )) TABLESPACE CODE;CREATE TABLE CUSER.criteria (id int not null,name varchar(48) null,type int null,date1 date null,date2 date null,content varchar(4000) null,note varchar(100) null,constraint pk_criteria PRIMARY KEY ( id )) TABLESPACE CODE;CREATE TABLE CUSER.onduty(odid varchar(16) not null,begintime date,endtime date,personid number(8,0),note varchar(255),constraint pk_onduty PRIMARY KEY ( odid )) TABLESPACE CODE;CREATE TABLE CUSER.dynamic(did varchar(16) not null,caption varchar(16),content varchar(255),ondate date,userrid varchar(6),constraint pk_dynamic PRIMARY KEY (did )) TABLESPACE CODE;CREATE TABLE CUSER.moutlaysort(mid varchar(16) not null,name varchar(30),constraint pk_moutlaysort PRIMARY KEY ( mid ) ) TABLESPACE CODE;create table cuser.treez (zcode varchar(4) not null,zstr varchar(20) null,constraint pk_treez PRIMARY KEY ( zcode )) TABLESPACE CODE;create table cuser.treek (kcode varchar (4) not null,kstr varchar(20) null,constraint pk_treek PRIMARY KEY ( kcode )) TABLESPACE CODE;create table cuser.article (fcode varchar(10) not null,name varchar(150) null,zcode varchar(4) null,kcode varchar(4) null,flag varchar(1) null,fbdate date null,memo varchar(80) null,constraint pk_article PRIMARY KEY ( fcode ) ) TABLESPACE CODE;/************************************************************************/ 物资:表空间MATERIAL,用户MUSER/************************************************************************/ CREATE TABLE MUSER.material(MNO number (18, 0) not null,SID varchar(6),MID varchar(4),M1 varchar(4),M2 varchar(14),M3 date,M4 varchar(2),M5 varchar(2),M6 int,M7 varchar(8),M8 varchar(40),M9 date,M10 number(9, 2),M11 number(11, 2),M12 number(11, 2),M14 varchar(16),M15 varchar(255),M16 date,M17 varchar(12),ORID varchar(6),IRID varchar(6),M161 date,M171 varchar(12),M31 varchar(255),M51 varchar(255),M18 varchar(1),M19 number,M20 number(18,0),irid varchar(6),constraint pk_material PRIMARY KEY (MNO) ) TABLESPACE MATERIAL;CREATE TABLE MUSER.MDETAIL (MNO NUMBER(18) NOT NULL,MID NUMBER(10) NOT NULL,AMOUNT NUMBER(10),TYPE VARCHAR2(1),CONSTRAINT PK_DETAIL PRIMARY KEY(MNO, MID) ) TABLESPACE MATERIAL;CREATE TABLE MUSER.danger(did number(18, 0) ,rid varchar(6),sid varchar(6) ,detail varchar(255) ,declarer varchar(8) ,dcdate date ,auditing varchar(8) ,addate date ,adsign varchar(1) ,suggestion varchar(255) ,occurdate date,note varchar(255),fileno varchar(16),CONSTRAINT PK_danger PRIMARY KEY(did)) TABLESPACE MATERIAL;CREATE TABLE MUSER.feedback (fid number (18, 0),rid varchar(6),sid varchar(6),docno varchar(16),mid varchar(4),num Number,reporter varchar(12),rpdate date,flag varchar(1),note varchar(255),CONSTRAINT PK_feedback PRIMARY KEY(fid)) TABLESPACE MATERIAL;CREATE TABLE MUSER.moutlay(mid number (18, 0) not null, filenum varchar(16),unitid varchar(6),mdate date,itemid number (18, 0),useid varchar(16),osort varchar(1),fee number(12, 2),flag varchar(1),remark varchar(255),userrid varchar(6),constraint pk_moutlay PRIMARY KEY (mid)) TABLESPACE MATERIAL;CREATE TABLE MUSER.stock(sid number (18, 0) not null, applytime date,applydepartment varchar(6),stockid varchar(1),msortid varchar(4),amount int,measure varchar(8),price number(9, 2),totalprice number(11, 2),stocker varchar(12),stocktime date,auditing varchar(12), auditingtime date,auditingsign varchar(1), auditingmind varchar(255),note varchar(255),mspecs varchar(12),userrid varchar(6),constraint pk_stock PRIMARY KEY (sid)) TABLESPACE MATERIAL;CREATE TABLE MUSER.repertory(rid number (18, 0) not null, areaid varchar(6),meterialid varchar(6),amount int,dutyman varchar(12),signaturetime date,distributetime date,auditing varchar(12),auditingtime date,auditingsign varchar(1),auditingmind varchar(255),note varchar(255),userrid varchar(6),constraint pk_repertory PRIMARY KEY (rid)) TABLESPACE MATERIAL;CREATE TABLE MUSER.factory(fid varchar(16) not null,name varchar(24),address varchar(24),mainproduct varchar(24),enrolfund number(16, 4),believe varchar(24),director varchar(8),linkmain varchar(8),tel varchar(12),fax varchar(12),email varchar(24),userrid varchar(6),constraint pk_factory PRIMARY KEY ( fid )) TABLESPACE MATERIAL;CREATE TABLE MUSER.product(pid varchar(16) not null,name varchar(4),specsid varchar(12),price number(9, 2),performance varchar(30),factoryname varchar(24),picture varchar(16),userrid varchar(6),constraint pk_product PRIMARY KEY ( pid )) TABLESPACE MATERIAL;**************************************************************************/ 经费:表空间OUTLAY 用户OUSER/***************************************************************************/CREATE TABLE OUSER.fxjf_files(f_id numeric (18,0) not null ,dscd varchar2(8) not null,dt date ,f_no varchar2 (40) not null,f_nm varchar2 (100) null,f_sort numeric (1,0) not null,rpun1 varchar2 (40) ,rpun2 varchar2 (40) ,sgis1 varchar2 (10) ,sgis2 varchar2 (10) ,rcun varchar2 (255) ,text0 varchar(4000) ,rm varchar2 (40) ,rm1 varchar2 (40) ,rm2 varchar2 (40) ,p_no number(18,0),image0 blob ,constraint pk_fxjf_files PRIMARY KEY (f_id)) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_01 (reg_cd varchar2 (8) not null,sub_cd varchar2 (8) not null,sub_nm varchar2 (20) ,constraint pk_fxjf_01 PRIMARY KEY ( reg_cd,sub_cd ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_11 (f_no numeric (18,0) not null ,dt date not null,c1 numeric(9, 2) ,c2 numeric(9, 2) ,c3 numeric(9, 2) ,c4 numeric(9, 2) null,c5 numeric(9, 2) null,c6 numeric(9, 2) null,c7 numeric(9, 2) null,c8 numeric(9, 2) null,c9 date null,sg numeric(1, 0) null,constraint pk_fxjf_11 PRIMARY KEY( f_no)) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_12 (i_no int not null,f_no numeric (18,0) not null,dt date not null,p_dscd varchar2 (8) not null,p_dt date not null,p_f_no varchar2 (40) not null,p_i_no int not null,uf_no varchar2 (40) null,u_date date null,u_item varchar2 (100) null,u_bankroll numeric(9, 2) null,l_item varchar2 (100) null,i_type numeric(1, 0) null,bankroll numeric(9, 2) null,bankrolltype numeric(1, 0) null,arrived_bankroll numeric(9, 2) null, earthwork numeric(9, 2) null,stonework numeric(9, 2) null, concretework numeric(9, 2) null, completed numeric(1, 0) null,isphoto numeric(1, 0) null,constraint pk_fxjf_12 PRIMARY KEY ( f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_13 (f_no numeric (18,0) not null,dt date not null,i_no int null,c1 numeric(9, 2) null,c2 numeric(9, 2) null,c3 varchar2 (128) null,c4 numeric(9, 2) null,c5 numeric(9, 2) null,c6 varchar2 (128) null,c7 numeric(9, 2) null,c8 numeric(9, 2) null,c10 numeric(9, 2) null,c11 numeric(9, 2) null,c12 varchar2 (128) null,c13 numeric(9, 2) null,c14 numeric(9, 2) null,c15 varchar2 (128) null,sg numeric(1, 0) null,constraint pk_fxjf_13 PRIMARY KEY ( f_no) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_14 (i_no smallint not null,f_no numeric (18,0) not null,dt date not null,c1 varchar2 (40) null,c2 varchar2 (40) null,c3 varchar2 (40) null,c4 varchar2 (40) null,c5 varchar2 (40) null,c6 varchar2 (40) null,c7 varchar2 (40) null,c8 numeric(6, 0) null,c9 varchar2 (128) null,c10 varchar2 (128) null,c11 numeric(6, 2) null,c12 numeric(6, 2) null,c13 numeric(6, 2) null,c14 numeric(9, 2) null,c15 numeric(9, 2) null,sg numeric(1, 0) null,constraint pk_fxjf_14 PRIMARY KEY ( f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_15 (i_no smallint not null,f_no numeric (18,0) not null ,dt date not null,c1 varchar2 (40) null,c2 varchar2 (40) null,c3 varchar2 (40) null,c4 varchar2 (40) null,c5 varchar2 (40) null,c6 varchar2 (10) null,c7 varchar2 (40) null,c8 varchar2 (40) null,c9 varchar2 (40) null,c10 varchar2 (128) null,c11 varchar2 (128) null,c12 numeric(6, 2) null,c13 numeric(6, 2) null,c14 numeric(6, 2) null,c15 numeric(9, 2) null,c16 numeric(9, 2) null,c17 varchar2 (128) null,sg numeric(1, 0) null,constraint pk_fxjf_15 PRIMARY KEY ( f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_16 (i_no int not null,f_no numeric (18,0) not null,dt date not null,c1 varchar2 (40) null,c2 varchar2 (40) null,c3 varchar2 (40) null,c4 varchar2 (40) null,c5 varchar2 (40) null,c6 varchar2 (40) null,c7 varchar2 (80) null,c8 varchar2 (60) null,c9 varchar2 (60) null,c10 varchar2 (60) null,c11 varchar2 (128) null,c12 numeric(6, 2) null,c13 numeric(6, 2) null,c14 numeric(6, 2) null,c15 numeric(9, 2) null,c16 numeric(9, 2) null,c17 varchar2 (128) null,sg numeric(1, 0) null,constraint pk_fxjf_16 PRIMARY KEY ( f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_17 (f_no numeric (18,0) not null,dt date not null,i_no smallint null,c1 varchar2 (128) null,c2 numeric(9, 2) null,c3 numeric(9, 2) null,c4 varchar2 (128) null,c5 numeric(9, 2) null,c6 numeric(9, 2) null,c7 varchar2 (128) null,c8 numeric(9, 2) null,c9 numeric(9, 2) null,c10 varchar2 (128) null,c11 numeric(9, 2) null,c12 numeric(9, 2) null,c13 varchar2 (128) null,c14 numeric(9, 2) null,c15 numeric(9, 2) null,c16 varchar2 (128) null,c17 numeric(9, 2) null,c18 numeric(9, 2) null,c19 varchar2 (128) null,c20 numeric(9, 2) null,c21 numeric(9, 2) null,c22 varchar2 (128) null,c23 numeric(9, 2) null,c24 numeric(9, 2) null,sg numeric(1, 0) null,constraint pk_fxjf_17 PRIMARY KEY ( f_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_03 (i_no int not null,f_no numeric (18,0) not null ,dt date null,p_nm varchar2 (255) null,c1 decimal(10, 3) null,c2 decimal(10, 3) null,p_sort int null,rm varchar2 (40) null,constraint pk_fxjf_03 PRIMARY KEY (f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_23 (f_no numeric (18,0) not null ,dt date not null,i_no int null,c1 int null,c2 numeric(7, 2) null,c3 numeric(12, 2) null,c4 numeric(7, 2) null,c5 numeric(9, 2) null,c6 clob null,sg numeric (1,0) null,constraint pk_fxjf_23 PRIMARY KEY ( f_no)) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_20 (i_no int not null,f_no numeric (18,0) not null,dt date not null,l_dscd varchar2 (8) null,uf_no varchar2 (40) null,u_date date null,u_item varchar2 (100) null,u_bankroll numeric(9, 2) null,l_item varchar2 (100) null,i_type numeric (1,0) null,bankroll numeric(9, 2) null,bankrolltype numeric (1,0) null,sg numeric (1,0) null,constraint pk_fxjf_20 PRIMARY KEY (f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_19 (p_no int not null,i_no int not null ,dt date null,sub_cd varchar2 (8) not null,p_nm varchar2 (255) null,c1 decimal(10, 3) null,c2 decimal(10, 3) null,c3 decimal(10, 3) null,c4 decimal(10, 3) null,c5 decimal(10, 3) null,c6 decimal(10, 3) null,c7 decimal(10, 3) null,c8 varchar2 (100) null,p_sort numeric(1, 0) null,rm varchar2 (40) null,rm1 varchar2 (40) null,rm2 varchar(40) null,rm3 varchar2 (40) null,constraint pk_fxjf_19 PRIMARY KEY ( p_no,i_no )) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_20_1(i_no int not null,f_no numeric (18,0) not null,dt date not null,l_dscd varchar2 (8) null,uf_no varchar2 (40) null,u_date date null,u_item varchar2 (100) null,u_bankroll numeric(9, 2) null,l_item varchar2 (100) null,i_type numeric (1,0) null,bankroll numeric(9, 2) null,bankrolltype numeric (1,0) null,sg numeric (1,0) null,constraint pk_fxjf_20_1 PRIMARY KEY ( f_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_04 (f_no numeric (18,0) not null,dt date null,c1 decimal(10, 3) null,c2 decimal(10, 3) null,c3 decimal(10, 0) null,c4 decimal(10, 0) null,c5 decimal(10, 3) null,c6 decimal(10, 3) null,c7 decimal(10, 3) null,c8 decimal(10, 0) null,c9 decimal(10, 3) null,c10 decimal(10, 0) null,c11 decimal(10, 3) null,c12 decimal(10, 3) null,rm varchar2 (40) null,constraint pk_fxjf_04 PRIMARY KEY(f_no) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_05 (f_no numeric (18,0) not null,dt date null,c1 decimal(10, 3) null,c2 decimal(10, 3) null,c3 decimal(10, 3) null,c4 decimal(10, 3) null,c5 decimal(10, 3) null,c6 decimal(10, 3) null,c7 decimal(10, 3) null,c8 decimal(10, 3) null,c9 decimal(10, 3) null,c10 decimal(10, 3) null,c11 decimal(10, 3) null,c12 decimal(10, 3) null,c13 decimal(10, 3) null,c14 decimal(10, 3) null,rm varchar2 (40) null,constraint pk_fxjf_05 PRIMARY KEY ( f_no) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_07 (i_no int not null,f_no numeric (18,0) not null,dt date ,sub_cd varchar2 (8),p_nm varchar2 (255) ,c1 decimal(10, 3) ,p_sort numeric(1, 0) ,rm varchar2 (40) ,rm1 varchar2 (40) ,rm2 varchar2 (40) ,rm3 varchar2 (40) ,sg varchar2 (1) ,constraint pk_fxjf_07 PRIMARY KEY ( i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_07_2 (p_no int not null,i_no numeric (18,0) not null,dt date null,sub_cd varchar2 (8) not null,p_nm varchar2 (255) ,c1 decimal(10, 3) ,c2 decimal(10, 3) ,c3 decimal(10, 3) ,c4 decimal(10, 3) ,c5 decimal(10, 3) ,c6 decimal(10, 3) ,c7 decimal(10, 3) ,c8 varchar2 (100) ,p_sort int,rm varchar2 (40),rm1 varchar2 (40),rm2 varchar2 (40),rm3 varchar2 (40),constraint pk_fxjf_07_2 PRIMARY KEY ( p_no,i_no ) ) TABLESPACE OUTLAY;CREATE TABLE OUSER.fxjf_khjf (dscd varchar2 (8) not null,dt int not null,c3 decimal(9, 2),constraint pk_fxjf_khjf PRIMARY KEY ( dscd,dt) ) TABLESPACE OUTLAY;。