⚡0 XP🔥0

Ch 8 · Database Concepts | डेटाबेस अवधारणाएँ

Lesson 8 of 10 ⏱ 3 min read ❓ 5-question quiz

Need for a database, DBMS, relational data model - relation, attribute, tuple, domain, degree, cardinality - and keys: candidate, primary, alternate and foreign.

Why databases?#

File systems suffer from data redundancy, inconsistency, difficult access and poor security. A DBMS (MySQL, Oracle, SQLite) stores data centrally and lets many users access it safely.

Relational data model terms#

Term Meaning
Relation a table
Attribute a column
Tuple a row
Domain set of allowed values for an attribute
Degree number of attributes (columns)
Cardinality number of tuples (rows)
हिंदी में समझें

संबंधात्मक मॉडल में डेटा तालिकाओं (relations) में रखा जाता है। कॉलम को attribute, पंक्ति को tuple कहते हैं। कॉलमों की संख्या को डिग्री और पंक्तियों की संख्या को कार्डिनैलिटी कहते हैं।

Keys#

  • Candidate key: any attribute(s) that can uniquely identify a row.
  • Primary key: the candidate key chosen to identify rows (unique and not NULL).
  • Alternate key: candidate keys not chosen as primary key.
  • Foreign key: attribute in one table that refers to the primary key of another table - links the tables.
Keys

STUDENT(AdmNo, RollNo, Name, Class). AdmNo and (Class, RollNo) are candidate keys. If AdmNo is the primary key, (Class, RollNo) is an alternate key. In FEES(AdmNo, Month, Amount), AdmNo is a foreign key referring to STUDENT.

हिंदी में समझें

प्राथमिक कुंजी (primary key) हर पंक्ति को अद्वितीय रूप से पहचानती है और NULL नहीं हो सकती। विदेशी कुंजी (foreign key) दूसरी तालिका की प्राथमिक कुंजी को संदर्भित करती है और तालिकाओं को जोड़ती है।

Exam tips#

  • If a table has 5 columns and 8 rows: degree = 5, cardinality = 8.
  • After a cartesian product of tables with degrees d₁, d₂ and cardinalities c₁, c₂: degree = d₁ + d₂, cardinality = c₁ × c₂.

Quick Quiz

Q1.

Number of rows in a relation is its

Q2.

A key that links two tables is the

Q3.

Candidate keys not chosen as primary key are

Q4.

Primary key values must be

Q5.

Cartesian product of tables with 3 and 4 rows has