第五章 元数据查询 查询数据库本身信息 表结构 索引等 5.1 查询test库下的所有表信息 MYSQL SELECT * from information_schema.`TABLES` WHERE TABLE_SCHEMA = 'test'; ORACLE select table_name from all_tables where owner = 'test'; 5.2 查询表中列的信息 MYSQL SELECT * from information_schema.`COLUMNS` W
第四章 插入更新和删除 4.1 插入数据 ,'PROGRA','NEW YOURK'); 4.2 从一个表向另一个表中复制 insert into dept_east(deptno,dname,loc)select deptno,dname,loc from dept where loc in ('NEW YORK','BOSTON'); 4.3 复制表结构 ; -- where is false 才没有数据复制过来 4.4 阻止对某几列插入 创建视图 让用户只操作视图中的列 当插入视图中时也相
第三章 操作多个表 表连接的内连接和外连接 A表 B表id name id name 1 a 1 b 2 b 3 c4 c内连接就是左表和右表相同的数据,查询结果只有相等的数据:select * from A inner join B on A.id=B.id select * from A,B where A.id=B.id id name id name 1 a 1 b 外连接分为:左外连接.右外连接.全外连接左外连接就是以左表为准,去匹配右表,左表有多少条数据,结果就是多少条数据selec
第二章 查询结果排序 2.1 按查询字段排序 order by sal asc; desc;-- 3表示sal 2.2 按子串查询 );--按job的最后两个字符排序 2.3 对字符数字混合排序 create view v as select ename ||' ' ||deptno as data from emp;--创建视图 select * from v; 创建视图后把两个字段链接成一个字符串 利用translate()函数把数字或者字符替换 然后排序 ','##########'),'