SQL高级语句 top / limit / rownum / percent (前XXX条数据) --top(SQL Server / MS Access) select top 条数 from 表; --percent(SQL Server) select top 20 percent * from 表 --选取前百分之20的数据 --limit(MySQL) select * from 表 limit 条数 --rownum(Oracle) select * from 表 where row…
数据定义语言 Data Definition Language Statements(DDL)数据操纵语言 Data Manipulation Language(DML) Statements事务控制 Transaction Control Statements 会话控制 Session Control Statements 系统控制 System Control Statements 嵌入SQL Embedded SQL Statements 数据定义语言 Create.alter和drop…
(1)在服务器上创建文件路径及文件 [oracle@redhat errormsg]$ touch test01.txt (2)在数据库中创建路径及授权 (3)创建存储过程 CREATE OR REPLACE PROCEDURE export_test01 IS export_handle UTL_FILE.file_type; BEGIN export_handle := UTL_FILE.FOPEN('LIJIAMAN_DIR', 'test01.txt', 'w'); FOR x IN (…
创建用户 -- Create the user create user U_HQ_JAVA default tablespace USERS temporary tablespace TEMP profile DEFAULT password expire;-- Grant/Revoke role privileges grant connect to U_HQ_JAVA;grant dba to U_HQ_JAVA;-- Grant/Revoke system privileges grant…
1.库表列信息 --取所有库 SELECT Name FROM Master..SysDatabases ORDER BY Name --查询所有表 select name from 库名..sysobjects where xtype in( 'u','v') order by xtype,name --查询所有列 SELECT COLUMN_NAME FROM 库名.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_Name = '表名' SELECT name…
1 判断数据库是否存在 if exists (select * from sys.databases where name = '数据库名') drop database [数据库名] 2 判断表是否存在 if exists (select * from sysobjects where id = object_id(N'[表名]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [表名] 3 判断存储过程是否存在…