SQL primary key, foreign key, normal form, query, operator

Source: Internet
Author: User
Tags logical operators sql primary key

Primary key and foreign key
Primary key: Is an index, help us quickly find, in the database to take out a column as the primary key, data is the only non-repeatable data can not be empty data, slowing down the new data
Right-click Table, point design, right-click column, set as primary key
Primary KEY Key Key
A foreign key is a constraint that constrains the source of a column of data from another table, which requires a column that is uniquely labeled
Unique (Make a column of data unique)


Remove the reference from the foreign key before deleting the data from the primary key
Identity (+)
Identity specification (is identity) identity seed (set int type)

Paradigm
The first paradigm: each column of data content to be single, unified
The second paradigm: try to relate directly to the primary key (the data from the foreign key table comes from the primary key list)
The third paradigm: the primary key as far as possible to reflect the data inside the table

CREATE TABLE Score
{
Code int PRIMARY KEY,
SCODE int references student (code),
Course varchar (20),
Score Decimal (18,2) Unique
}
Unquestionably

Condition query: Select *from student where code=1
Select *from Student where code>2
The meaning of or in the query (for logical operators)
Math operator: +-*/% (% = remainder)
Assignment operator: =
Comparison operators: >=, <=,! =,!<,!>, <>, <, >
Logical operators: And OR

SQL primary key, foreign key, normal form, query, operator

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.