SQL--零碎笔记

查询:一个花瓶对应多个花
group by 花瓶 having count(花) >1

A,B两张表,都有ID这一列,如何提取两张表的这一列中不相同的值
select * from a where id not in (select id from b )

不等于 要习惯用 <> 表达;减少用 !=

dbo.t_student st(nolock)

st.FGrade<>-1 —[-1 不用引起来]

给表起别名的话,可以随意起,看个人习惯,可以有一个规范:
eg:
t_student ts
t_name tn
t_class tc
eg:
t_student t1
t_name t2
t_class t3

Guess you like

Origin blog.csdn.net/Mimo_YY/article/details/120324553