随笔分类 - T-SQL
摘要:江竹筠 353827476 INNER JOIN ON vs WHERE clause https://stackoverflow.com/a/1018825/3782855 INNER JOIN is ANSI syntax which you should use. It is generall
阅读全文
摘要:Not equal <> != operator on NULL 问题 Could someone please explain the following behavior in SQL? SELECT * FROM MyTable WHERE MyColumn != NULL (0 Result
阅读全文
摘要:What is the difference between UNION and UNION ALL? UNION removes duplicate records (where all columns in the results are the same), UNION ALL does no
阅读全文
摘要:comparison of truncate vs delete in mysql/sqlserver [duplicate] DELETE DELETE is a DML Command. DELETE statement is executed using a row lock, each ro
阅读全文
摘要:传递多个参数 https://stackoverflow.com/questions/28481189/exec-sp-executesql-with-multiple-parameters Here is a simple example: EXEC sp_executesql @sql, N'@
阅读全文
摘要:https://stackoverflow.com/questions/129077/not-in-clause-and-null-values This issue came up when I got different records counts for what I thought wer
阅读全文
摘要:SQL Server: Difference between PARTITION BY and GROUP BY 回答1 They're used in different places. group by modifies the entire query, like: select custom
阅读全文
摘要:redgate给出的提示 https://www.red-gate.com/hub/product-learning/sql-prompt/consider-using-not-exists-instead-not-subquery Phil Factor explains why you shou
阅读全文
摘要:a1和a2在a表中具有唯一性 b1和b2在b表中具有唯一性 现在需要连接c表和d表 需要分两步来做 1.先让c表join表a和表b select c.*,a.a2,b.b2 from c inner join a on c.a1=a.a1 inner join b on c.b1=b.b1 将这个的
阅读全文
摘要:http://www.runoob.com/sql/sql-union.html 使用sql server数据库 构造数据 查询两张表中的数据 进行union 只能对union后的结果进行排序
阅读全文
摘要:https://docs.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql Determines the partitioning and ordering of a rowset before the ass
阅读全文
摘要:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql Generates an error message and initiates error processing for the
阅读全文
摘要:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql Evaluates a list of conditions and returns one of multiple possible res
阅读全文
摘要:https://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins How can a LEFT OUTER JOIN return more records than exist in the left tab
阅读全文
摘要:https://docs.microsoft.com/en-us/sql/t-sql/functions/datediff-transact-sql 返回值是,用结束时间,减去开始时间
阅读全文
摘要:先从表里面筛选数据,并且添加RowNumber列,把这个筛选结果作为result 然后从result中进行二次筛选,通过pagesize和pageindex来进行分页 generate row numbers in the same order the data are added. 从表里筛选数据
阅读全文
摘要:方法1 https://stackoverflow.com/questions/2334712/how-do-i-update-from-a-select-in-sql-server 方法2 https://stackoverflow.com/questions/1068447/update-wit
阅读全文
摘要:SQL Server loop - how do I loop through a set of records By using T-SQL and cursors like this : https://stackoverflow.com/questions/28506747/sql-loop-
阅读全文
摘要:https://docs.microsoft.com/en-us/sql/t-sql/language-elements/control-of-flow The Transact-SQL control-of-flow language keywords are:
阅读全文
摘要:Column 'dbo.tbm_vie_View.ViewID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. htt
阅读全文