Sql server® 2012 t-sql fundamentals



Download 10,93 Mb.
Pdf ko'rish
bet42/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   38   39   40   41   42   43   44   45   ...   443
Bog'liq
BookSQL

 

CHAPTER 1

 

Background to T-SQL Querying and Programming



 

 7

duedate, shipdate) allows three distinct dates per order, whereas the relations Employees(empid) and 

EmployeeChildren(empid, childname) allow zero to countable infinity children per employee. 

Other examples of constraints include candidate keys, which provide entity integrity, and foreign 



keys, which provide referential integrity. A candidate key is a key defined on one or more attributes 

that prevents more than one occurrence of the same tuple (row in SQL) in a relation. A predicate 

based on a candidate key can uniquely identify a row (such as an employee). You can define multiple 

candidate keys in a relation. For example, in an Employees relation, you can define candidate keys on 



employeeid, on SSN (Social Security number), and others. Typically, you arbitrarily choose one of the 

candidate keys as the primary key (for example, employeeid in the Employees relation), and use that as 

the preferred way to identify a row. All other candidate keys are known as alternate keys.

Foreign keys are used to enforce referential integrity. A foreign key is defined on one or more at-

tributes of a relation (known as the referencing relation) and references a candidate key in another (or 

possibly the same) relation. This constraint restricts the values in the referencing relation’s foreign key 

attributes to the values that appear in the referenced relation’s candidate key attributes. For example, 

suppose that the Employees relation has a foreign key defined on the attribute departmentid, which 

references the primary key attribute departmentid in the Departments relation. This means that the val-

ues in Employees.departmentid are restricted to the values that appear in Departments.departmentid.




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   38   39   40   41   42   43   44   45   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish