摘要:
写代码时大家都会使用缩进(indentation)和对齐(alignment),这是两个相关而又不同的概念,两者都是为了提高代码的可读性。缩进出现在一行的最左边,目的是明显地区分开包含与被包含的代码;对齐则是为了使代码美观、整洁。下例中,类的两个成员变量相对于类名来说具有一级缩进;两个变量的注释部分采用了对齐显示。它使用了Tab(假设一个Tab等于8个空格的大小)来缩进和对齐,一块绿色表示一个Tab。同样的代码,在另一个开发人员的机器上(一个Tab等于4个空格的大小)打开可能就不再对齐:造成这一现象的原因是代码的对齐使用了Tab,而不同编辑器的Tab键大小设置不一样。因此下一个Tab stop 阅读全文
摘要:
A primary key is defined as a column or a group of column that their value are always be unique. Normally, NULL value will never be allowed in this column to be part of this column’s records.EXAMPLE :Let’s say we want to create a table name Users. The PRIMARY KEY will be user_id for that table. SQL 阅读全文
摘要:
ROUP BY clause is used to associate an aggregate function with groups of rows. The SQL GROUP BY clause is used along with the SQL aggregate functions like SUM, COUNT, MAX, MIN, and AVG to provide means of grouping the result by refer to certain database table column.The SQL syntax for GROUP BY ... 阅读全文
摘要:
The HAVING clause is used in combination with the GROUP BY clause and the SQL aggregate functions. HAVING clause allows us to call the data conditionally on the column that return from using the SQL aggregate functions.The SQL HAVING syntax is simple and looks like this:SELECT [COLUMN NAME 1] , AGG. 阅读全文
摘要:
After being learn through all the displaying data syntax. It’s time to learn how to sort data by using ORDER BY.Yes it is. ORDER BY clause allows you to sort the records in your result set. This clause can only be used in SELECT statements. The ORDER BY clause sorts the result set based on the colum 阅读全文
摘要:
n relational database, Index will be the important mechanism for boosting performance. Index is important like Index for a book that helps you quickly find the pages that you wanted to read, index on the column speeds data retrieval.CREATE INDEX Statement will look like this:CREATE [UNIQUE] INDEX [I 阅读全文
摘要:
There are two types of aliases that are used most frequently in SQL command: which is column alias and table alias.Why ALIAS? There is some reasons alias to be use when querying a SQL command.- alias in a long query can make your query easier to read and understand- alias table is use when using a s 阅读全文
摘要:
here are some additional clause in the SQL language that can be used to simplify queries by decrease the use of the single Operator repeatly. One of them is IN clause.IN clause is used to simplify the queries if you want to select data that meet a large number of options. That means IN function help 阅读全文
摘要:
一.使用流程要使用sqlite,需要从sqlite官网下载到三个文件,分别为sqlite3.lib,sqlite3.dll,sqlite3.h,然后再在自己的工程中配置好头文件和库文件,同时将dll文件放到当前目录下,就完成配置可以使用sqlite了。使用的过程根据使用的函数大致分为如下几个过程:sqlite3_open()sqlite3_prepare()sqlite3_step()sqlite3_column()sqlite3_finalize()sqlite3_close()这几个过程是概念上的说法,而不完全是程序运行的过程,如sqlite3_column()表示的是对查询获得一行里面的 阅读全文
摘要:
SQL INTERSECT is query that allows you to select related information from 2 tables, this is combine 2 SELECT statement into 1 and display it out.INTERSECT produces rows that appear in both queries.that means INTERSECT command acts as an AND operator (value is selected only if it appears in both stat 阅读全文
摘要:
QL UNION is query that allows you to select related information from 2 tables, this is combine 2 SELECT statement into 1 and display it out.UNION will only return DISTINCT value only. Which means will eliminate duplicate records that returned.There are some condition that need to meet when using the 阅读全文
摘要:
QL UNION ALL is query that allows you to select related information from 2 tables, the result is different from the UNION statement. It return all the record from SELECT statement that used.UNION ALL selects all rows from each table and combines them into a single table.The syntax is as follows:SELE 阅读全文
摘要:
The SELECT INTO statement is usually used to create backup copies of tables. That also explain that SELECT INTO creates a new table and fills it with data computed by a query.SELECT INTO syntax is:SELECT [COLUMN NAME 1], [COLUMN NAME 2] ,... INTO [BACKUP TABLE NAME] FROM[TABLE NAME] EXAMPLE 1 ... 阅读全文
摘要:
A JOIN command is queries that combine data from more than 1 table.For two tables that want to join together need to have some data in common, like unique id that link this 2 tables together. Normal join will need a joining condition or connecting column to display out the joined data. 1 joining con 阅读全文
摘要:
A INNER JOIN command is queries that combine data from more than 1 table.For two tables that want to join together need to have some data in common, like unique id that link this 2 tables together. INNER JOIN will need a joining condition or connecting column to display out the joined data. 1 joinin 阅读全文
摘要:
When we want to select out all the record from two table, no matter it's present at second table or not, we will have to use SQL OUTER JOIN command.There are 3 type of OUTER JOIN, which is: LEFT OUTER JOIN RIGHT OUTER JOIN FULL OUTER JOINSQL OUTER JOIN syntax:SELECT * FROM [TABLE 1] OUTE... 阅读全文
摘要:
最近在讲到T-SQL查询的Join部分时,一下子没有想起来CROSS JOIN的用法,因为其实平常也确实基本不用到。特意找了一个例子,以供参考CROSS JOIN又称为笛卡尔乘积,实际上是把两个表乘起来。以下资料摘自:http://www.sqlguides.com/sql_cross_join.phpSQL CROSS JOIN will return all records where each row from the first table is combined with each row from the second table. Which also mean CROSS JO 阅读全文
摘要:
一、基本的SELECT语句 1. “*”的注意事项:在SELECT语句中,用*来选取所有的列,这是一个应该抵制的习惯。 虽然节省了输入列名的时间,但是也意味着获得的数据比真正需要的数据多的多。相应的,也会降低应用程序的性能及网络性能。 良好的规则是只选所需。 2. join子句 join是用来定义如何从多个表中选取数据并组合成一个结果集。 join必需是因为(1)我们所要获取的所有信息并不都在一个表中,或者(2)所要返回的信息都在一个表中,但是其上设置的条件信息却在另一个表中。 join的共同点是通过记录的连接列,把一条记录同一条或者多条其他记录进行匹配,从而产生出是这些记录的超级的记... 阅读全文