摘要:
多表操作 自连接 表的自身与自身做连接 Select a.sname as 小类别名称,b.sname as 大类别名称 from t_mc_type a,t_mc_type b where a.npid = b.nid 内连接 结果为两张表符合关联关系的结果集数据。不相等不在结果集中。 解决不相等的数据办法: 创建表,必须定义表之间的主外键关系。 Select a.nid,a.sname,a.nmaxid,b.sname from t_mc a,t_mc_type b where a.nmaxid = b.nid and a.nid>10 Select a.nid,a.... 阅读全文
摘要:
1:空表DUAL 只能存放返回一行的数据。 Select sysdate from dual; Select seq_t_mc.nextval from dual;2:单列 Select Nid from T_mc; Select Nid,sname from t_mc;所有列 Select * from t_mc;别名: 可以为字段/表/视图取另一个名称. Select NID,NID as 类别ID号 from t_mc t; Select NID,NID 类别ID号 from t_mc t;常量列 Select '博洋教育' as company,t.* from t_u 阅读全文