SQL笔记
程序员文章站
2022-05-08 21:25:52
...
//创建表
CREATE TABLE myemp (mid NUMBER(4),mname VARCHAR2(20),birthday DATE);
//创建表及导入数据
CREATE TABLE myemp AS SELECT empno,ename,hiredate FROM emp;
//删除表
DROP TABLE myemp;
//insert语句
INSERT INTO myemp (empno,ename,hiredate) VALUES (7788,'FSL',SYSDATE);
//快速复制
INSERT INTO myemp (empno,ename,hiredate) SELECT empno,ename,hiredate FROM emp;
//Update语句
UPDATE myemp set hiredate=to_date('2013-1-1','YYYY-MM-DD') WHERE ename='FSL';
//DELETE语句
DELETE FROM myemp WHERE ename='FSL';
//SELECT 语句
select * from emp;
分页查询
select t.* from (select e.*,rownum rn from emp e where rownum <=10) t where t.rn >=6
CREATE TABLE myemp (mid NUMBER(4),mname VARCHAR2(20),birthday DATE);
//创建表及导入数据
CREATE TABLE myemp AS SELECT empno,ename,hiredate FROM emp;
//删除表
DROP TABLE myemp;
//insert语句
INSERT INTO myemp (empno,ename,hiredate) VALUES (7788,'FSL',SYSDATE);
//快速复制
INSERT INTO myemp (empno,ename,hiredate) SELECT empno,ename,hiredate FROM emp;
//Update语句
UPDATE myemp set hiredate=to_date('2013-1-1','YYYY-MM-DD') WHERE ename='FSL';
//DELETE语句
DELETE FROM myemp WHERE ename='FSL';
//SELECT 语句
select * from emp;
分页查询
select t.* from (select e.*,rownum rn from emp e where rownum <=10) t where t.rn >=6