整理了日常用到的一些sqls 1.插入表 insert into table_B select * from table_A 2.清空表 truncate table test #清空表,结构还存在delete table test where ... #删除表中特定的数据drop table test #删除整表,包括结构 3. 导出到文件 select * from table_A where filed1 like '8422%' into outfile '/usr/local/mysq…
--====================简单增删改===========--查看学生表的全部数据select * from studio --插入一个新的学生信息insert into studio(st_name,st_sex,st_age,st_add,st_tel) values("黄兰淇",0,36,'南充','13943943334')--查看class全部数据select * from class--向class表增加两条条数据insert into class(c…
1.查询字段中含有小写字母的数据 SELECT MATERIALCODE FROM RFXITEMATTENDCODE WHERE REGEXP_LIKE(MATERIALCODE,'([a-z])'); 2.修改小写字母为大写字母 UPDATE RFXITEMATTENDCODE SET MATERIALCODE=UPPER(MATERIALCODE) WHERE REGEXP_LIKE(MATERIALCODE,'([a-z])'); 3.查询字段中含有空格的数组 SELECT * FROM…
) AS t1 LEFT JOIN (SELECT * FROM dbo.xcqy2017_News_Classification) AS t2 ON t2.Ncid = t1.Ncid left join左链接 以左表为主表 ) AS t1 RIGHT JOIN (SELECT * FROM dbo.xcqy2017_News_Classification) AS t2 ON t2.Ncid = t1.Ncid right join右链接 以右表为主表 SELECT CASE THEN '新闻…
批量插入 insert into table select ... union all select... insert into table (...) values (...) , (...) insert into table select ... from ... 高效分页 select t.* from ( * ,ROW_NUMBER() over (order by ID desc ) RN from test ) t --和Oracle有效率的写法一样,都是尽可能在子查询去过滤…
1.查看内存使用情况 select * from sys.dm_os_sys_memory 2.查看当前进程的情况 select * from sys.sysprocesses 3.查看非系统进程的使用情况(spid是50以后进程) select * from sys.dm_exec_connections 4.查看当前登录用户拥有的权限 select * from sys.fn_my_permissions(null,'server')select * from sys.fn_my_perm…
创建表,create TABLE table( 列名称1 数据类型1, 列名称2 数据类型2, 列名称3 数据类型3, ......); eg: create table TABLE_24751( id NUMBER not null, code VARCHAR2(30) not null, des_id NUMBER not null, enabled_flag NVARCHAR2(1), created_by NUMBER not null, creation_date DATE not n…