
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A comprehensive overview of sql fundamentals, covering key concepts such as database structure, normalization, joins, transactions, and data types. It includes a series of questions and answers to reinforce understanding and test knowledge. Suitable for students and professionals seeking to learn or refresh their sql skills.
Typology: Quizzes
1 / 24
This page cannot be seen from the preview
Don't miss anything!
SQL stands for Structured Query Language. It is a programming language used for managing and manipulating relational databases.
A database is an organized collection of data stored and accessed electronically. It provides a way to store, organize, and retrieve large amounts of data efficiently.
A primary key is a column or combination of columns that uniquely identifies each row in a table. It enforces the entity integrity rule in a relational database.
A foreign key is a column or combination of columns that establishes a link between data in two tables. It ensures referential integrity by enforcing relationships between tables.
A primary key is used to uniquely identify a row in a table and must have a unique value. On the other hand, a unique key ensures that a column or combination of columns has a unique value but does not necessarily identify the row.
The DELETE statement is used to remove specific rows from a table based on a condition. It can be rolled back and generates individual delete operations for each row. TRUNCATE , on the other hand, is used to remove all rows from a table. It cannot be rolled back, and it is faster than DELETE as it deallocates the data pages instead of logging individual row deletions.
UNION and UNION ALL are used to combine the result sets of two or more SELECT statements. UNION removes duplicate rows from the combined result set. whereas UNION ALL includes all rows, including duplicates.
The WHERE clause is used to filter rows based on a condition before the data is grouped or aggregated. It operates on individual rows. The HAVING clause , on the other hand, is used to filter grouped rows based on a condition after the data is grouped or aggregated using the GROUP BY clause.
A transaction is a sequence of SQL statements that are executed as a single logical unit of work. It ensures data consistency and integrity by either committing all changes or rolling them back if an error occurs.
Atomicity ensures that a transaction is treated as a single unit of work, either all or none of the changes are applied. Consistency ensures that a transaction brings the database from one valid state to another. Isolation ensures that concurrent transactions do not interfere with each other. Durability ensures that once a transaction is committed, its changes are permanent and survive system failures. ACID stands for Atomicity, Consistency, Isolation, and Durability. It is a set of properties that guarantee reliable processing of database transactions.
A deadlock occurs when two or more transactions are waiting for each other to release resources, resulting in a circular dependency. As a result, none of the transactions can proceed, and the system may become unresponsive.
A database is a container that holds multiple objects, such as tables, views, indexes, and procedures. It represents a logical grouping of related data. A schema, on the other hand, is a container within a database that holds objects and defines their ownership. It provides a way to organize and manage database objects.
CHAR is a fixed-length string data type, while VARCHAR is a variable-length string data type.
A stored procedure is a set of SQL statements that are stored in the database and can be executed repeatedly. It provides code reusability and better performance.
A subquery is a query nested inside another query. It is used to retrieve data based on the result of an inner query.
A view is a virtual table based on the result of an SQL statement. It allows users to retrieve and manipulate data as if
NULL represents the absence of a value or unknown value. It is different from zero or an empty string and requires special handling in SQL queries.
A materialized view is a physical copy of the view's result set stored in the database, which is updated periodically. It improves query performance at the cost of data freshness.
A correlated subquery is a subquery that refers to a column from the outer query. It executes once for each row processed by the outer query.
The DISTINCT keyword is used to retrieve unique values from a column or combination of columns in a SELECT statement.
CHAR stores fixed-length character strings, while VARCHAR stores variable-length character strings. The storage size of CHAR is constant, while VARCHAR adjusts dynamically.
The TOP (in SQL Server) or LIMIT (in MySQL) clause is used to limit the number of rows returned by a query. It is often used with an ORDER BY clause.
UNION combines the result sets of two or more SELECT statements vertically, while JOIN combines columns from two or more tables horizontally based on a join condition.
A data warehouse is a large, centralized repository that stores and manages data from various sources. It is designed for efficient reporting, analysis, and business intelligence purposes.
A primary key is a chosen candidate key that uniquely identifies a row in a table. A candidate key is a set of one or more columns that could potentially become the primary key.
The CASE statement is used to perform conditional logic in SQL queries. It allows you to return different values based on specified conditions.
The COALESCE function returns the first non-null expression from a list of expressions. It is often used to handle null values effectively.
The ROW_NUMBER() function assigns a unique incremental number to each row in the result set. It is commonly used for pagination or ranking purposes.ll values effectively.
A natural join is an inner join that matches rows based on columns with the same name in the joined tables. It is automatically determined by the database.
The CASCADE DELETE constraint is used to automatically delete related rows in child tables when a row in the parent table is deleted.