易截截图软件、单文件、免安装、纯绿色、仅160KB

What Is SQL?

What Is SQL?
SQL (pronounced as the letters S-Q-L or as sequel) is an abbreviation for Structured Query Language. SQL is a language designed specifically for communicating with databases.
Unlike other languages (spoken languages like English, or programming languages like Java or Visual Basic), SQL is made up of very few words. This is deliberate. SQL is designed to do one thing and do it well—provide you with a simple and efficient way to read and write data from a database.
What are the advantages of SQL?
SQL is not a proprietary language used by specific database vendors. Almost every major DBMS supports SQL, so learning this one language will enable you to interact with just about every database you'll run into.
SQL is easy to learn. The statements are all made up of descriptive English words, and there aren't that many of them.
Despite its apparent simplicity, SQL is actually a very powerful language, and by cleverly using its language elements you can perform very complex and sophisticated database operations.
And with that, let's learn SQL.
 
SQL Extensions : Many DBMS vendors have extended their support for SQL by adding statements or instructions to the language. The purpose of these extensions is to provide additional functionality or simplified ways to perform specific operations. And while often extremely useful, these extensions tend to be very DBMS specific, and they are rarely supported by more than a single vendor.
Standard SQL is governed by the ANSI standards committee, and is thus called ANSI SQL. All major DBMSs, even those with their own extensions, support ANSI SQL. Individual implementations have their own names (PL-SQL, Transact-SQL, and so forth).


相关文档:

SQL中case when then的使用实例

假设现在News表有以下字段
News_Id,News_Title,News_IsSetTop,News_SetTopTime
其中News_IsSetTop(char(1))是“是否置顶”的含义;News_SetTopTime(DateTime)是置顶时间;
现在要实现:如果News_IsSetTop为"1"时 ,ORDER BY News_IsSetTop DESC,News_Id DESC;News_IsSetTop为"0"时,ORDER BY News_ID DESC ......

SQL Server日期

---一个月的第一天
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) 
--- 本周的星期一
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
---一年的第一天
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
----季度的第一天
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
----上个月的最后一天
......

简单但有用的SQL脚本

行列转换
create table test(id int,name varchar(20),quarter int,profile int)
insert into test values(1,'a',1,1000)
insert into test values(1,'a',2,2000)
insert into test values(1,'a',3,4000)
insert into test values(1,'a',4,5000)
insert into test values(2,'b',1,3000)
insert into test values(2, ......

SQL round()详解


SQL中round()函数用法
SQL round()详解
round有两个重载,一个有带有两个参数的,一个是带有三个参数的,
每一个参数都相同是要处理的数,
1.带有两个参数.每二个参数是小数点的左边第几位或右边第几位,分别用正负表示.左边为负,右边为负.为四舍五入.
select round(748.585929,-1) 750.000000
select round(748.58592 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号