sql 备忘
**************************************
**** sql 查询备忘 ****
**************************************
一:外连接:
1、左外连接(把join左边表里的所有数据都查出来。然后把join 右边表中的符合条件的数据加在左边表的后面。。。。)
SELECT * from t_empl_info as a LEFT OUTER JOIN t_dept as b
ON a.dept_no=b.dept_id
--通常情况下是:左边表是多方表。右边表是一方表
--三张表的左外连接
SELECT *
from A left join B
on A.a=B.a
left join C on B.b = C.b;
相关文档:
1. Q. What is a join?
A. Join is a process of retrieve pieces of data from different sets (tables) and returns them to the user or program as one joined collection of data.
2. Q. Can a table have more than one foreign key defined?
A. A table can have any number of foreig ......
在运行窗口输入regedit,打开注册表编辑器,在HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager中找到PendingFileRenameOperations,删除该键值,关闭注册表编辑器。重新安装SQL Server 2000,此时,就可以正常进入期待的安装界面了。 ......
曾经遇到这样的情况,在数据库的Meeting表中有PublishTime (DateTime,8)字段,用来存储一个开会时间,在存入时由于要指明开会具体时间,故格式为yyyy-mm-dd hh:mm:ss,而我们查询时是通过yyyy-mm-dd来进行的,即查询某一天的所有会议信息,这样如果通过select * from Meeting where PublishTime=@PublishTime (参数@PublishTime为y ......
最近刚学会在VB2008 中使用参数化SQL语句,于是马上用到代码中,却碰到查不到任何数据的情况,纠结了好几天,还是没有搞明白,差点吐血。不得已还是先在代码中使用字符串拼接的SQL语句。
包含参数化SQL语句的代码如下:
Dim cmSl As N ......
我说的不定条件是指查询条件的个数不定。有时一个,有时两个,有时好几个。
首先我发现
select * from A where a='kkk' 与
select * from A where a like 'kkk'
其实效果是一样,只要 like 后面的字符串不包含通配符。这样一来就很方便了。譬如有
select * from A where a='KKK' and b='LLL'
有两个查询条件, ......