摘要:
view 可以看做一张虚拟表,是通过某种运算得到的一个投影 视图不需要指定视图的列名或者列类型,因为它只是一个影子,继承了上面的关系 查询的结果命名为视图 语法 create view 视图名 as select 语句 create view pjasselect goods_name,shop_price from goods order by shop_price;视图创... 阅读全文
posted @ 2013-11-27 16:14
long896130895
阅读(141)
评论(0)
推荐(0)
摘要:
从表中删除数据使用delete,从表中删除特定的行,或者所有行 delete from customers 删除哪一表中where cust_id =1006; 哪一列一定要注意,update后面是没有from的,直接跟表名,而 delete后面有from 然后再跟表名更新表 alter table vendors 更新表 表名add ven... 阅读全文
posted @ 2013-11-27 03:18
long896130895
阅读(124)
评论(0)
推荐(0)
摘要:
1要更新的表 2列名和他们的新值 3确定要更新运行的条件 update customers 要更新的表名set cust_email='123@qq.com' 赋新值where cust_id = 1005; 执行条件,更新哪一行ignore关键字如果用update语句更新多行,并且在更新这些行中的一行或者多行发生一个错误,则整个update操... 阅读全文
posted @ 2013-11-27 03:14
long896130895
阅读(134)
评论(0)
推荐(0)
摘要:
insert 一般用来给表插入一个指定列值的行,但是insert还存在另外一种形式,可以利用它将一条select语句的结果插入到表中,这就是所谓的insert select ,顾名思义,它是由一条insert语句和一条select语句组合成的 insert into customers ( cust_id, cust_name)select cust_id, cust_name... 阅读全文
posted @ 2013-11-27 03:04
long896130895
阅读(346)
评论(0)
推荐(0)
摘要:
组合查询通常称为并(union)或者复合查询(compound query) union的每个查询必须包含相同的列,表达式或者聚集函数(不过各个列不需要以相同的次序列出) 使用union all 返回所有行,重复的不再隐藏 阅读全文
posted @ 2013-11-27 02:40
long896130895
阅读(179)
评论(0)
推荐(0)
摘要:
select cust_name,cust_contactfrom customers as c,orders as o,orderitems as oiwhere c.cust_id = o.cust_id and oi.order_num = o.order_num and prod_id = 'tnt2';上语句中 customers as c 建立c作为customers的别名... 阅读全文
posted @ 2013-11-27 01:30
long896130895
阅读(256)
评论(0)
推荐(0)
摘要:
select vend_name,prod_name,prod_price from vendors,productswhere vendors.vend_id=products.vend_idorder by vend_name,prod_name;内部联结 select vend_name,prod_name,prod_price from vendors inner join pro... 阅读全文
posted @ 2013-11-27 00:42
long896130895
阅读(142)
评论(0)
推荐(0)

浙公网安备 33010602011771号