Database and SQL language

Source: Internet
Author: User

Paradigm:

1NF: First paradigm. Relational mode r each value in the domain of all attributes is no longer decomposed.

2NF: Second paradigm. If R is the first paradigm, and every non-primary property in R is dependent on a candidate key of R. (Transitive dependency)

3NF: the third paradigm. If R is the second normal, and each non-primary attribute does not pass a candidate key that relies on R.

BCNF:BC paradigm. If R is the first paradigm, and each attribute does not pass a candidate key that relies on R.

4NF: The fourth paradigm. D is a multivalued dependency set on R, and if a non-trivial multivalued dependent x→→y is established in D, the x must be the super-key of R, then the fourth normal form.

database Transactions : Refers to a series of operations performed as a single logical unit of work.

Transactions have the characteristics of atomicity, consistency, independence, and persistence.

Atomicity: A transaction is either fully executed or not executed.

Consistency: The operation of a transaction does not alter the consistency of the data in the database.

Independence: Transactions do not interleave.

Persistence: After a transaction runs successfully, updates to the system are permanent.

cursor : The row that is used to locate the result set. By judging the global variable @ @FETCH_STATUS can determine whether the last, if not equal to 0 indicates an error or to the end.

External mode/Logic mode image function: Ensure the logical independence of data;

Mode/Internal mode image function: Ensure the physical independence of the data.

SQL language: Structured Query Language, standard language for relational databases.

Query: Select (Query block: Select From where Statement

Definition: Create, DROP, alter

Manipulation: Insert, UPDATE, delete

Control: Grant (Authorization), REVOKE (revoke authorization)

Example: 1, find the table PPP inside NUM Minimum number:

SELECT * FROM PPP where num <=all (select num from PPP)

Select top 1 num from PPP ORDER by num

SELECT * from PPP where num = (select Min (num) from PPP)

2. Copy table (copy structure only, source table A, new table B)

SELECT * to B from A where 1=0

3. Create a temporary table

CREATE Table #Temp (Field 1 type, field 2 type ... )

4, the symbol used to connect the string is +

5, surname Zhang: Like ' Zhang% ';

"_" means any character;

6, according to the results of descending order, if the same results in ascending order by the school number

Order by grade DESC, XH ASC

7. Total number of enquiries

Select COUNT (*) from student

8, statistical average of more than 80 of students, list number and average scores

Select Xh,avg (Grade)

From SC

GROUP BY XH

Having avg (grade) >=80

Database and SQL language

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.