Databases Flashcards
what is a relational database
A database that organizes data into tables, where rows represent records and columns represent attributes, with relationships established between tables
What is an attribute in a database?
a column in a table that represents a specific characteristic of the data.
Define a primary key.
a unique identifier for each row in a table, ensuring that no two rows have the same key.
What is a composite primary key?
A primary key that consists of two or more attributes combined to uniquely identify each row
What is a foreign key?
an attribute that links two tables by referencing the primary key of another table.
What is database normalization?
The process of organizing data in a database to reduce redundancy and improve integrity by splitting larger tables into smaller, related ones.
Why normalize a database?
To eliminate redundancy, maintain data integrity, and improve query performance.
what is first normal form
- Ensures each column contains atomic (indivisible) values.
- Eliminates repeating groups of data
second normal form
- Meets all requirements of 1NF.
- Ensures that all non-key attributes are fully dependent on the primary key.
third normal form
- Meets all requirements of 2NF.
- Ensures that no non-key attribute depends on another non-key attribute (i.e., no transitive dependencies).
What does the SQL JOIN statement do?
combines rows from two or more tables based on a related column, usually a foreign key
What is an SQL SELECT statement used for
An SQL SELECT statement is used to retrieve data from one or more tables.
What does the SQL INSERT statement do?
adds new rows of data to a table.
properties that the relations in a fully normalised database must have
- data is atomic
- no partial key dependencies
- every non key attribute is dependent upon the key