If you ever had a casual heartbeat from database data corruption: Error additions, updates , deletions. Then the following plan must be able to heal your wounds!For a database small white, any mistakes in the database can be said to be fatal.
1. General termsCartesian product, primary key, foreign keyData integrity
Entity integrity: The primary attribute cannot be null, for example, the school number and course number cannot be empty
Referential integrity: The foreign key
Thank you for reading. Like, useful please eldest brother and sister-in-mercy "recommend" it! Your spiritual support is the powerful writing power of bloggers and the power to reproduce the collection. Welcome Reprint!
Copyright NOTICE: This
Please pay attention to and correctly configure the SQL Server instance and database parameters, the generalized configuration is recommended as follows:1, the initial size of the data and log files are set to 10G and 2G respectively, are set to the
--the declaration of the variable, which must be added with the @ symbol before the variable is declared in SQLDECLARE @i INT--the assignment of a variable, which must be set before the variable is assignedSET @i = 30--Declaring multiple
Connection query: You can implement multiple table queries by using the Join operator. Connection is the main feature of relational database model, and it is also a sign that distinguishes it from other types of database management system.Common two
1. Left returns the number of characters in the string that are specified in the beginning.SELECT left (' ABCDEFG ', 2);----AB2. Right returns the specified number of characters in the string starting from the left.SELECT Right (' ABCDEFG ',
Simple Query SelectSimple data retrieval: SELECT * from T_employeeRetrieve only required columns: SELECT fname,fage from T_employeeColumn aliases: SELECT fnumber as number, FName as name, Fage as Age111 from T_employeeUse where to retrieve
Insert multiple rows of data:1.insert into ... Select to extract data from one table into another existing table2.select into extracting data from a table into a new table3.insert into ()UnionList of Select constantssecond, simple query1. Querying
The following is the execution of the SQL code, only take a simple read data examples, other detailed, please see for yourselfexecsp_configure'Show advanced Options',1Reconfigureexecsp_configure'Ad Hoc Distributed
We often have this requirement in our production practice: Group numbering.There is a City area table region as follows:We need to group the above table region by city and sort the region to get the following result:The specific SQL is as follows:1
Database can not duplicate name 5030 error, in fact, the simple reason is that there is an application is consuming this connection, use such a line of command to query out the occupied connectionUse master select spid from master.dbo.sysprocesses
When SQL Server enters data, it can be maintained with the ident_current and Checkident commands when it encounters a primary key ID that needs to be maintained.ident_currentThe command returns the last identity value generated by the specified
List all files used by the current databaseTransfer data from a file in the current filegroup to another file in the same filegroupDBCC shrinkfile (' file ', emptyfile);Remove a file from a filegroupRemove filegroupsAdd a file groupALTER DATABASE
Analysis:The database design should follow three main paradigms, respectively:First paradigm: Ensure the atomicity of each column in the table (non-detachable); Second paradigm: Make sure that each column in the table is related to the primary key,
1. Open the database for Microsoft SQL server2008, and enter the following command:At this point, but see the port number is 1619, remember this port number, will be used later.2, open myeclipse2014, find the top myeclipse->open
Analyze the influence of SQL Server focusing on index on non-clustered index, and analyze SQL
Preface
In the process of learning SQL 2012 basic tutorial will occasionally interspersed with other content to explain, I believe that I have read SQL
Description: SQL Server focuses on mandatory Index query conditions and Columnstore Index. column is a row Index.
Preface
In this section, we will introduce the indexing knowledge, the date type in the data type, the short content, and a deep
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.