(min_hd) * 12 +
4 (month (max_hd)-month (min_hd) as mnth
5 from (
6 select Min (hiredate) as min_hd, max (hiredate) as max_hd
7 from EMP
8) x
9) y
Oracle
Using the months_between function, you can get the number of months of difference between two dates (to get the number of years of difference, you only need to divide it by 12 ):
1 select months_between (max_hd, min_hd ),
2 months_between (max_hd, min_hd)/12
3 from (
4 select Min (hiredate) min_hd,
Tags: effects except top NULL tool IMG class GROUP by SELTransferred from: http://bbs.csdn.net/topics/360019248 How can I get the starting and ending dates for each successive date and the number of days and the days from the last end of the previous period, could I use a SQL implementation?Note: The database environment is SQL
Left outer join salaries as z
On B. name = z. name and B. maxdate2 = z. sal_date
Go
---- Method 2: This method numbers the rows in each employee, and then extracts the dates closest to the two employment dates,
--- (SQL 2005 or later)
Select s1.name,
MAX (case when rn = 1 then sal_date else null end) as curr_date,
MAX (case when rn = 1 then salary else null en
Red Gate Series 4 SQL data compare 10.2.0.885 edition data comparison and synchronization Tool complete cracking + tutorial
Red Gate SeriesArticle:
SQL compare 10.2.0.1337 edition, one of the red gate series, database comparison tool, complete cracking + tutorial
Red Gate Series ii
SQL compare 10.2.0.1337 edition, one of the red gate series, database comparison tool, complete cracking + tutorial
Red Gate SeriesArticle:
SQL compare 10.2.0.1337 edition, one of the red gate series, database comparison tool, complete cracking + tutorial
Red Gate Series ii S
Tags: compressed file version serve 10.2.0.1 generate full image Gen testRed Gate Series Articles: One of the Red Gate series SQL Compare 10.4.8.87 Edition Database comparison tool complete hack + tutorial Red Gate Series two SQL Source control 3.0.13.4214 Edition Database version controller complete hack + use tutorial Red Gate Series Three
Tags: ges open the menu bar using the Install package product hive text hintFirst, the use of the tutorialSQL Compare is a tool commonly used by programmers to compare the differences between two databases. Can be used to compare objects inside the database. such as stored procedures, data in the database, the structure of the table. Let me briefly explain how to
One of the Red Gate series SQL Compare 10.4.8.87 Edition Database comparison tool complete hack + tutorialRed Gate Series two SQL Source control 3.0.13.4214 Edition Database version controller complete hack + use tutorialRed Gate Series Three SQL Server development tool
.asp?id=1210302
The book belongs to the story:
DECLARE @Birthday smalldatetime
Set @Birthday = ' 1949-6-5 '
--use more than one date variable, in order to expand: To calculate the future or a moment in time of the exact age of the function!
DECLARE @ smalldatetime
SET @ = GETDATE ()
Select DateDiff (year, @Birthday, @)
+ Case when DateAdd (Year,datediff, @Birthday, @), @Birthday) Then 1
else 0
End
Again the first one:
1. Calculate the number of Monday to Sunday between any two
Label:Compare the time size of a string type The time in the database is varchar type, MySQL uses curdate () to get the current date, and SQL Server gets the current date by GETDATE () 1. Use strings directly to compare Note: To ensure that the two data types are exactly the same, an exception For example a: "2016-09-01", if the B data is: "2016-9-2", then can n
Compare SQL query Performance statements--First Use set STATISTICS io and set STATISTICS time to see if performance tuning is valid. --set STATISTICS time on--SET STATISTICS time onBefore starting our example, run the following two commands ( do not execute on the server you are using ).These two commands will clear the SQL
Open the query analyzer and select "show Execution Plan", "Show server trace", and "show Customer statistics" in the query menu.
In the editing window, enter the SQL statement to be compared, for example, different query methods:
Select *From crm_fwdWhere RQ between '2017-06-01 'and '2017-06-02'Select *From crm_fwdWhere datediff (day, RQ, '2017-06-01 ') = 0After the two
Dbo.f_struniteGo/*ID value----------- -----------1 AA,BB2 AAA,BBB,CCC(The number of rows affected is 2 rows)*/--===================================================================================2. New workaround (resolves in SQL Server 2005 with outer apply, etc.). )CREATE table TB (ID int, value varchar (10))INSERT into TB values (1, ' AA ')INSERT into TB values (1, ' BB ')INSERT into TB values (2, ' AAA
Label:Using EF's own small functions need to encounter inner join and group by combination of use and anonymous type of processing, search a lot, basically can not meet their own needs, so summed up also realized on their own write out, has been prepared to view and partner query Reference (General statement query does not say, the network search a lot) Statement query background (or not directly look at the statement is also very tough): the main want to achieve similar features of QQ album dis
DatePart (date element, date): Returns the integer of the date part specified by the date element
Datename (date element, date): A date name that returns a date element in the form of a string that specifies the time
DateDiff (date element, date 1, date 2): Returns the difference between two days and converts it to the form of the specified date element
DateAdd (date element, value, date): Returns the new date of date plus value by date unit given by date element
11. Microsoft SQL server network settingsOverview of Network ServicesSQL Server application interfaceNetwork Connection LibraryNetwork components and SQL server performanceNetwork MonitoringSummaryAfter you install Microsoft SQL
ansi SQL standard. SQL Server uses an extended set of ANSI SQL-92, called a T-SQL, which complies with the ANSI SQL-92 standards.The SQL language includes two main programming language
, I've been looking at so much data every day (there are also up to 1 billion on the previous TB), or you can manage them with SQL Server.I would like to explain how to compare the amount of data: the volume of The comparison data should be compared with the actual size of the database, and should not be compared with the size of the single-table data volume! Here is an example: before our database
Artificial Intelligence automatic SQL optimization tools-SQLTuning for SQL Server, SQL-sqltuning
In response to this situation, the artificial intelligence automatic SQL optimization tool came into being. Now I will introduce this tool: SQLTuning for
, the server performs the modification. Select this concurrency option optimistic withRow VERSIONING: This optimistic concurrency control option is based on row version control. With row versioning, the table must have a version identifier that the server can use to determine whether the row has changed since it was read into the cursor.In SQL
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.