欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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