Novice database

The last day () number belongs months EOMONTH inquiry date data;

 

YEAR (COL) year of the date of the output data, month (col) output date data of the month;

 

When the difference in the query data exist of: in a first query, then the query only once conditions. The later exists is to run a select statement, check out all the data in the operating conditions statement, multiple queries, the number of queries that table.length;

 

Where the difference with HAVING: having and where the screening are used, and where the group HAVING screening screening record, the polymerization can be followed by further HAVING functions, where not;

 

row_number window function: given a unique order data, row_number () over (conditions) as an alias;

 

case when then else end: Select the condition statement;

 

cross / full join: includes not only a symbolic link table rows match, further comprising two connecting all records in the table;

 

left / right (outer) join: both matching symbolic link connection table row, all rows include the left (right) of the connection table;

 

dateadd (); add or subtract a specified time interval to a date, DATEADD (datepart, number, date): date parameter is valid date expression. number is the number of intervals you want to add; for a time in the future, this number is a positive number, for the last time, this number is negative.

 

DATEDIFF () function returns the number of days between two dates: DATEDIFF (datepart, startdate, enddate), startdate argument is legitimate and enddate date expression.

 

Add back left join on condition with the added distinction conditions where: increasing the back where the condition after the temporary table generating, filtering. But on condition that the conditions of use in generating a temporary table, regardless of whether it is on the condition is true, it will return the records to the left of the table.

When used LEFTJOIN, placed directly behind the condition ON, is connected after the first filter, put back condition WHERE, is connected to the first screening

 

Guess you like

Origin www.cnblogs.com/wafs521/p/11250014.html