Compare SQL Server, Oracle, and DB2
I. Openness:
SQL ServerIt can only run on windows without any openness. The stability of the operating system is very important to the database.The Windows9x series products focus on desktop applications, and the NT Server is only s
] EXCEPT SELECT * from [dbo].[t1_new] ) asT;SELECT * from [dbo].[t1_new]SELECT * from [dbo].[T1_old]If the results are not correct, then the inconsistent conclusions are given directly.Method Four: Use the full table inner JOIN, this is also the worst practice, of course, this refers to the table records in the case of super-many casesDECLARE @t1_newcount BIGINTDECLARE @count BIGINTSELECT @t1_newcount = C
1. Character functions:
The characters in SQL Server are case-insensitive.However, the lower and upper functions are common in SQL Server, Oracle, and DB2. For example, select empno, ename, deptno from EMP where upper (ename) = upper ('bucket ');
Example of connection chara
* from [dbo].[t1_new] ) asT;SELECT * from [dbo].[t1_new]SELECT * from [dbo].[T1_old]If the results are not correct, then the inconsistent conclusions are given directly.Method Four: Use the full table inner JOIN, this is also the worst practice, of course, this refers to the table records in the case of super-many casesDECLARE @t1_newcount BIGINTDECLARE @count BIGINTSELECT @t1_newcount = COUNT(*) fromt1_new;SELECT @count
The constraint is used to force the row data to meet specific business rules (the data type is to force the column data to meet the rules)There are five types of constraints: • not null • unique • primary key • Foreign key • check the not null constraint on SQL Server: • Create Table u_emp (• empno bigint, • ename varchar (10) Not null, • job varchar (9), • Mgr bigint, • hiredate date, • Sal decimal (7,2),
Start
A while ago, a project encountered such an SQL query requirement. There were two tables with the same structure (table_left table_right), as shown below:
Figure 1.
Check whether there is a group of (groupId) data in table table_right that is exactly the same as its data.
1. We can see that the table_left and table_right tables have two groups of data that are completely equal:
Figure 2.
Analysis
From the above two tables, we can know that the
ROUPID=A.GROUPID)
Method 1 Vs. Method 2:
Both Method 1 and Method 2 can be used to find the group #11 in which the table Table_left exists exactly equal in table_right data. However, in terms of performance, Method 2 is more slightly than Method 1 to see the statistical information of their execution process:
Method 1:
Figure 5.
Method 2:
Figure 6.
If the data volume is large, then method 2 has more obvious advantages than Method 1. Because of Method 1, more than two update datapa
In the data room charging system, there are several such situations:
Start date and end date. I believe you are smart enough to figure out why there are two date controls! Yes, it is to find records in these two date ranges from a table!
Some people just said, it's not easy!
Suppose we define the first control as Begin, and the second control as Over! The query statement is notCopy codeThe Code is as follows:"Select * from recharge_info where date What's the problem! However, the fact is not tha
Start
A while ago, a project encountered such an SQL query requirement. There were two tables with the same structure (table_left table_right), as shown below:
Figure 1.
Check whether there is a group of (groupId) data in table table_right that is exactly the same as its data.
1. We can see that the table_left and table_right tables have two groups of data that are completely equal:
Figure 2.
Analysis
From the above two tables, we can know that the
An index is a database object used to accelerate database queries.
The principle is to reduce the IO operations of the query to accelerate.
Index types:• Clustered index: sort and store the data rows according to the key values of the data rows in the table or view. • Non-clustered index: it has a structure independent of data rows. • unique index: Make sure that the index key does not contain duplicate values.
Indexes created on SQL
The syntax of the create statement is the same, and the data types are different.
However, the syntax for creating a table using subqueries is different.
SQL Server statements created using subqueries:Select empno, ename, Sal * 12 annsal, hiredate into dept30 from EMP where deptno = 30;
Oracle uses query to create a table:Create Table dept30
Select empno, ename, Sal * 12 annsal, hiredate
From EMP
Where de
@t1_newcount=COUNT (*)FromT1_new;SELECT@count=COUNT (*)From[T1_old]AsAINNERJOIN[T1_new]As BOn[B].[Id]=[A].[Id]and[B].[Log_time]=[A].[Log_time]-- If there are other fields in the table that you add yourself print print @t1_newcount if ( @count = @t1_newcount ) begin ' equal "end else begin select Span style= "color: #ff0000;" > ' Method five: With SQL Server's own Tablediff tool, Microsoft made this tool to comp
Oracle database The process of creating temporary tables and the contrast with the different points of the SQL Server Temp table is the main content of this article, let's take a look at this part of the content, we hope to be able to help you.
1. Introduction
In addition to saving permanent tables, Oracle databases can also create temporary tables temporary tables. These temporary tables are used to hold
The Oracle tutorial you are looking at is: oracle8i and Microsoft SQL Server comparison.
ArchitectureMicrosoft operates according to the distribution of the customer/server architecture. This approach produces unnecessary cost and complexity. Oracle has found a better answer to the Internet. In a multi-tiered (multi-tiered) architecture of the Internet computing,
Search the internet about the data types of comparison, there are almost no three database comparison, I wrote some of the comparison of the fields, if there is a wrong place, please feel free.
Java fields
Oracle Fields
MySQL Field
SQL Server Fields
Int
Number
Int
Int
Java.lang.double
Number (P,s)
Double
Float
It is very important to develop database applications and choose a good database. This article compares SQL Server with Oracle, DB2 three kinds of database from some aspects, provides some reference for you to choose the database.
Open
SQL Server
Can only run on Windows, without the slightest openness, the stability
Open SQL Server can only run on Windows, without the slightest openness, and the stability of the operating system is important to the database. Windows9x Series products are focused on desktop applications, NT server only for small and medium enterprises. And the reliability, security, and scalability of Windows platforms are very limited. It is not as time-t
It is very important to develop database applications and choose a good database. This article compares SQL Server with Oracle, DB2 three kinds of database from some aspects, provides some reference for you to choose the database.
Open
SQL Server
Can only run on Windows, without the slightest openness, the stability
Search for a lot of related information on the Internet and summarize the reasons for this situation mainly because of sorting rules:If no sorting rule is specifiedWhether the temporary table is case sensitive depends on the order of the tempdb database.Whether database objects are case sensitive depends on Database so
, and then use the temporary tables in turn with the left join ... on I finally get the results I want.The actual practiceThe above idea in I think of the moment I was denied, this is the cycle, but also the efficiency of the connection query will be very slow and later people maintenance is also more troublesome. With my colleague's reminder, I used the case to solve the problem.The final code is as follows:Select Realname as ' name ', count (
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.