Database Flashcards
(26 cards)
What is a database?
A database is an organized collection of structured information or data, typically stored electronically in a computer system.
What is a DBMS?
A Database Management System (DBMS) is software that interacts with users, applications, and the database to capture and analyze data.
What is SQL?
SQL (Structured Query Language) is a standard programming language used to manage and manipulate relational databases.
What are the types of SQL commands?
DDL, DML, DCL, and TCL.
What does the SELECT statement do?
It retrieves data from one or more tables.
What is the difference between WHERE and HAVING?
WHERE filters rows before grouping; HAVING filters after grouping.
How do you insert data into a table?
INSERT INTO table_name (column1, column2) VALUES (value1, value2);
How do you update a record in SQL?
UPDATE table_name SET column1 = value1 WHERE condition;
How do you delete a record from a table?
DELETE FROM table_name WHERE condition;
What is a JOIN in SQL?
A JOIN combines rows from two or more tables based on a related column.
Name the types of JOINs.
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN.
What is a subquery?
A query nested inside another query.
What is the difference between IN, EXISTS, and ANY?
IN checks if a value is in a list, EXISTS checks if a subquery returns any row, ANY compares to any value returned by a subquery.
What is a primary key?
A unique identifier for each record in a table.
What is a foreign key?
A field in one table that refers to the primary key in another table.
What is a unique constraint?
Ensures that all values in a column are different.
What is the difference between NULL and ‘’ (empty string)?
NULL represents the absence of a value; ‘’ is a value (an empty string).
What is normalization?
The process of organizing data to reduce redundancy and improve integrity.
What are the normal forms?
1NF, 2NF, 3NF, BCNF.
What is denormalization?
Combining tables to reduce the number of joins and improve read performance.
What is an index?
A database object that improves the speed of data retrieval operations on a table.
What is a composite index?
An index on two or more columns of a table.
What is a transaction?
A sequence of one or more SQL operations that are executed as a single unit.
What does ACID stand for?
Atomicity, Consistency, Isolation, Durability.