Fundamentals of Database Systems - Chapter 4: Structured Query Language (SQL)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/56

flashcard set

Earn XP

Description and Tags

Comprehensive vocabulary flashcards covering SQL concepts from Chapter 4 of Fundamentals of Database Systems by Elmasri and Navathe, including SQL categories (DDL, DML, DCL, DQL, TCL), integrity constraints, set operations, aggregate functions, joins, subqueries, and triggers.

57 Terms

1
New cards

Structured Query Language (SQL)

A database language used to operate databases, including database creation, database deletion, fetching data rows, and modifying and deleting data rows.

2
New cards

SQL Data Types

The categories of data formats supported in SQL: Numeric (int, float), Character String (char, varchar), Unicode Character String (nchar, ntext), Binary (binary, image), Date and Time (date, datetime), and Miscellaneous (xml, json).

<p>The categories of data formats supported in SQL: Numeric (int, float), Character String (char, varchar), Unicode Character String (nchar, ntext), Binary (binary, image), Date and Time (date, datetime), and Miscellaneous (xml, json).</p>
3
New cards

SQL Command Categories

The five main categories into which SQL commands are classified: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), and Data Query Language (DQL).

<p>The five main categories into which SQL commands are classified: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Transaction Control Language (TCL), and Data Query Language (DQL).</p>
4
New cards

Data Definition Language (DDL)

A category of SQL commands used to define data structures and modify data by creating, altering, and deleting database objects such as tables, views, indexes, and users (e.g., CREATE, ALTER, DROP, TRUNCATE).

5
New cards

CREATE TABLE

A DDL statement used to establish and define new database objects such as tables, specifying column names and their data types.

6
New cards

ALTER TABLE

A DDL statement used to modify the structure of an existing relation, such as adding a new attribute (column) and its data type to a base table.

7
New cards

TRUNCATE TABLE

A DDL command used to delete all complete data rows from a table while preserving the table structure.

8
New cards

DROP TABLE

A DDL command used to remove a base relation and its definition entirely from the database, preventing it from being queried or updated thereafter.

9
New cards

Integrity Constraints

A set of predefined rules in a DBMS that ensure data accuracy, consistency, and reliability while preventing accidental database damage, automatically checked during INSERT, UPDATE, and DELETE operations.

10
New cards

Entity Integrity Constraint

A rule stating that the primary key of a table cannot contain a NULL value because it uniquely identifies each specific record.

11
New cards

Key Constraint

A rule specifying that at least one attribute or combination of attributes must uniquely identify every row in a table to prevent duplicate rows from being inserted.

12
New cards

Domain Constraint

A rule ensuring that every value entered into a column belongs to a valid, predefined set of acceptable values, defining its data type, size, format, and permissible values.

13
New cards

Referential Integrity Constraint

A rule that maintains consistency between two related tables by requiring that a foreign key in a child table must either match a primary key in the parent table or be completely NULL.

14
New cards

Check Constraint

A rule that validates whether values in a column satisfy a specific logical, boolean condition (such as Salary≥0Salary \ge 0 or Age≥18Age \ge 18) before saving data.

15
New cards

Data Manipulation Language (DML)

A class of SQL statements used to query, edit, add, and delete row-level data from database tables or views (includes INSERT, UPDATE, and DELETE).

16
New cards

INSERT Command

A DML command that allows users to add new rows or records of data into a database table.

17
New cards

UPDATE Command

A DML command used to modify the values of single or multiple existing columns in a database table based on a specified condition.

18
New cards

DELETE Command

A DML statement used to remove one or more specific data records/rows from a table satisfying a WHERE condition.

19
New cards

Data Control Language (DCL)

SQL commands used to manage database security, user access, and permissions by granting or revoking authorities on database objects.

20
New cards

GRANT Command

A DCL command that provides specific access privileges (such as SELECT, INSERT, UPDATE, DELETE, or ALL PRIVILEGES) on a database object to a user account or role.

21
New cards

REVOKE Command

A DCL command that removes previously granted privileges from a user account or role, thereby restricting access.

22
New cards

Data Query Language (DQL)

A subset of SQL used to fetch data from the database, consisting of the SELECT statement.

23
New cards

SELECT Statement

A DQL statement used to retrieve subsets of information and attributes from one or more tables, functioning similarly to the projection operation of relational algebra.

24
New cards

Asterisk (*) Wildcard

A symbol used in a SELECT statement to retrieve all columns from a table without listing each column name individually.

25
New cards

Compound Queries

SQL queries containing set operators that combine the results of two component queries into a single unified result set.

26
New cards

UNION Operator

A set operator that combines results from two or more SELECT statements and eliminates duplicate rows; both queries must have the same number of columns and compatible datatypes.

27
New cards

UNION ALL Operator

A set operator that combines the results of two queries and returns all rows including all duplicates without sorting the data.

28
New cards

INTERSECT Operator

A set operator that combines two SELECT statements and returns only the distinct rows that are common to both queries.

29
New cards

MINUS Operator

A set operator that returns distinct rows present in the first query but absent in the second query, arranged in ascending order by default with no duplicates.

30
New cards

Aggregate Functions

SQL functions that perform calculations on multiple values to return a single value, ignoring NULL values in computations (except when using COUNT).

31
New cards

SUM Function

An aggregate function that calculates the total sum of all selected values across a numeric field.

32
New cards

MIN Function

An aggregate function used to find the smallest value among all selected values in a column.

33
New cards

MAX Function

An aggregate function used to find the largest value among all selected values in a column.

34
New cards

AVG Function

An aggregate function that calculates the mean value of a numeric column across all non-NULL values.

35
New cards

COUNT Function

An aggregate function that counts the number of rows in a database table, applicable to both numeric and non-numeric types and including NULLs and duplicates when using COUNT(*).

36
New cards

DISTINCT Clause

A clause used within a SELECT query to filter out duplicate rows and retrieve only unique values from a column.

37
New cards

LIKE Operator

A pattern-matching operator used in a WHERE clause to compare strings against specified wildcard patterns.

38
New cards

Percent (%) Wildcard

A pattern-matching character used with the LIKE operator that matches any substring of any length (including zero characters).

39
New cards

Underscore (_) Wildcard

A pattern-matching character used with the LIKE operator that matches exactly one single character.

40
New cards

NULL Value

A marker in a table field indicating the absence of any value, evaluated in SQL using the IS NULL or IS NOT NULL operators.

41
New cards

JOIN Clause

A SQL clause that links and retrieves data from two or more related tables based on a specified join condition, usually involving foreign keys.

42
New cards

INNER JOIN

The default and most common join type that returns only the records from multiple tables that satisfy the specified join condition (matching rows in both tables).

<p>The default and most common join type that returns only the records from multiple tables that satisfy the specified join condition (matching rows in both tables).</p>
43
New cards

OUTER JOIN

A join type that returns both matching rows and non-matching rows from the joined tables, subdivided into Left, Right, and Full outer joins.

44
New cards

LEFT OUTER JOIN

A join that returns all matching rows as well as all non-matching rows from the left table, placing NULL values in attributes originating from the right table.

<p>A join that returns all matching rows as well as all non-matching rows from the left table, placing NULL values in attributes originating from the right table.</p>
45
New cards

RIGHT OUTER JOIN

A join that returns all matching rows as well as all non-matching rows from the right table, inserting NULL values for attributes originating from the left table.

<p>A join that returns all matching rows as well as all non-matching rows from the right table, inserting NULL values for attributes originating from the left table.</p>
46
New cards

FULL OUTER JOIN

A join that returns matching data from both tables alongside all remaining non-matching rows from both the left and right tables, using NULLs where matches do not exist.

<p>A join that returns matching data from both tables alongside all remaining non-matching rows from both the left and right tables, using NULLs where matches do not exist.</p>
47
New cards

GROUP BY Clause

A clause that groups rows sharing identical values in specified columns into summary subgroups so that aggregate functions can be applied to each subgroup independently.

48
New cards

HAVING Clause

A clause used following GROUP BY to filter aggregated groups based on a specified condition, allowing the inclusion of aggregate functions which the WHERE clause cannot support.

49
New cards

View

A virtual table in SQL that does not store data physically but presents dynamic rows and columns derived from one or more underlying base tables.

50
New cards

Nested Query (Subquery)

A complete SELECT query embedded within another query (typically within the WHERE clause), where the outer query uses the intermediate results of the inner query.

51
New cards

IN Operator

A set membership connective operator that evaluates whether an outer query column value is present in the collection of values returned by an inner query or specified list.

52
New cards

NOT IN Operator

A connective operator that tests for the absence of set membership, confirming that an outer query column value does not exist within the inner query's result set.

53
New cards

Trigger

A special stored database procedure tied to a specific table that automatically executes in response to defined data manipulation (INSERT, UPDATE, DELETE) or schema definition events.

54
New cards

Statement-Level Trigger

A trigger that executes exactly once for the entire triggering event, performing an action based on the overall effect of an INSERT, UPDATE, or DELETE statement rather than per row.

55
New cards

Row-Level Trigger

A trigger that executes once for each individual row affected by the triggering INSERT, UPDATE, or DELETE statement (indicated by FOR EACH ROW).

56
New cards

DML Triggers

Triggers that automatically execute in response to table data manipulation operations, consisting of INSERT, UPDATE, and DELETE triggers.

57
New cards

DDL Triggers

Triggers that fire in response to schema changes and structural definition events in the database, including CREATE, ALTER, and DROP actions.