SQL Query Clauses and Database Operations: Key Concepts for Beginners

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/94

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

95 Terms

1
New cards

What does the SELECT clause do in SQL?

Determines which columns appear in the result set.

2
New cards

What does the FROM clause do in SQL?

Identifies the table(s) used in the query.

3
New cards

What does the WHERE clause do?

Filters rows based on a condition.

4
New cards

What does the GROUP BY clause do?

Groups rows to be used with aggregate functions.

5
New cards

What does the HAVING clause do?

Filters groups after aggregation.

6
New cards

What does ORDER BY do?

Sorts results in ascending or descending order.

7
New cards

What is the rule of precedence in SQL?

Arithmetic → Comparison → NOT → AND → OR.

8
New cards

What does DISTINCT do in SQL?

Removes duplicate rows from a result.

9
New cards

What does BETWEEN do?

Tests whether a value is within a range (inclusive).

10
New cards

What does IN do?

Tests whether a value matches any value in a list.

11
New cards

What does LIKE do?

Performs pattern matching with wildcards.

12
New cards

What wildcard does LIKE use for multiple characters?

%

13
New cards

What wildcard does LIKE use for one character?

_

14
New cards

What does IS NULL check?

Whether a value is NULL.

15
New cards

What does SUM() do?

Adds numeric values in a group.

16
New cards

What does AVG() do?

Computes average of numeric values.

17
New cards

What does COUNT(*) do?

Counts all rows.

18
New cards

What does MIN() do?

Returns smallest value in a set.

19
New cards

What does MAX() do?

Returns largest value in a set.

20
New cards

What is an equijoin?

A join where tables are linked using equality =.

21
New cards

What is a natural join?

A join matching columns with the same name.

22
New cards

What is a self-join?

A table joined with itself.

23
New cards

What is a cross join?

Produces Cartesian product of two tables.

24
New cards

What is a left outer join?

Shows all rows from left table plus matches from right.

25
New cards

What is a right outer join?

Shows all rows from right table plus matches from left.

26
New cards

What is a view?

A virtual table defined by a query.

27
New cards

What does CREATE VIEW do?

Creates a view based on a SELECT query.

28
New cards

What does CREATE TABLE do?

Defines a new table structure.

29
New cards

What does ALTER TABLE do?

Modifies an existing table structure.

30
New cards

What does DROP TABLE do?

Removes a table and its data.

31
New cards

What does CREATE INDEX do?

Creates an index to speed up searching.

32
New cards

What does INSERT do?

Adds new rows to a table.

33
New cards

What does UPDATE do?

Modifies existing rows.

34
New cards

What does DELETE do?

Deletes rows.

35
New cards

What does COMMIT do?

Saves all database changes permanently.

36
New cards

What does ROLLBACK do?

Reverts database changes since last commit.

37
New cards

What is a recursive query?

A query that refers to itself to handle hierarchical data.

38
New cards

What is relational algebra?

A formal language defining operations on relations (tables).

39
New cards

What does UNION do?

Combines results of two queries and removes duplicates.

40
New cards

What does INTERSECT do?

Returns rows common to both queries.

41
New cards

What does EXISTS test?

Whether a subquery returns any rows.

42
New cards

What does a subquery do?

Runs a query inside another query.

43
New cards

What is a transaction?

A sequence of operations treated as a single unit.

44
New cards

What does ACID stand for?

Atomicity, Consistency, Isolation, Durability.

45
New cards

Define Atomicity.

All operations succeed or none do (all-or-nothing).

46
New cards

Define Consistency.

A transaction must leave the database in a valid state.

47
New cards

Define Isolation.

Transactions cannot interfere with each other.

48
New cards

Define Durability.

Committed changes persist even after failure.

49
New cards

What is a schedule?

An ordering of operations from multiple transactions.

50
New cards

What is a serial schedule?

Transactions executed one at a time.

51
New cards

What is a serializable schedule?

Concurrent execution that matches the result of a serial schedule.

52
New cards

What is a dirty read?

Reading uncommitted data.

53
New cards

What is a nonrepeatable read?

A value changes between two reads in the same transaction.

54
New cards

What is a phantom read?

New rows appear between two reads.

55
New cards

What is two-phase locking?

Growing phase (acquire locks) and shrinking phase (release locks).

56
New cards

What is strict two-phase locking?

Holds write locks until commit.

57
New cards

What is deadlock?

Two transactions wait for each other indefinitely.

58
New cards

What is recovery?

Restoring database consistency after failure.

59
New cards

What does a checkpoint do?

Saves database state to speed up recovery.

60
New cards

What is a DBMS architecture layer?

Tools → Query Processor → Storage Engine → File System.

61
New cards

What is a distributed database?

A database stored on multiple networked nodes.

62
New cards

What is replication?

Storing copies of data on multiple machines.

63
New cards

What is primary-secondary replication?

Writes go to primary; replicas receive updates later.

64
New cards

What is eventual consistency?

Replicas become consistent over time, not immediately.

65
New cards

What is a data warehouse?

A separate analytic database with historical, integrated data.

66
New cards

What is a data mart?

A smaller warehouse for a specific department.

67
New cards

What is ETL?

Extract, Transform, Load — prepares data for a warehouse.

68
New cards

What is a multi-tier architecture?

Separation of web browser, web server, app server, DB server.

69
New cards

What is sharding?

Splitting data across multiple machines.

70
New cards

What is a simple data type?

Integer, decimal, character, date, binary.

71
New cards

What is a complex data type?

Arrays, JSON, XML, spatial, object types.

72
New cards

What is a collection type?

A type storing multiple values (set, array, list).

73
New cards

What is a document type?

Stores semi-structured data like JSON or XML.

74
New cards

What is a spatial type?

Represents geometric shapes: POINT, LINESTRING, POLYGON.

75
New cards

What is an object type?

A type supporting attributes, methods, inheritance.

76
New cards

What is embedded SQL?

SQL statements written inside another programming language.

77
New cards

What is procedural SQL?

SQL with loops, variables, and control flow (stored procedures).

78
New cards

What is an API in DB programming?

A library allowing programs to interact with databases.

79
New cards

What is ODBC/JDBC?

Database APIs for C#/Java to connect and execute SQL.

80
New cards

What is a stored procedure?

A saved SQL program executed with CALL.

81
New cards

What is a trigger?

Code that runs automatically on INSERT/UPDATE/DELETE.

82
New cards

What are the 5 V's of Big Data?

Volume, Velocity, Variety, Veracity, Value.

83
New cards

What is NoSQL?

Non-relational databases designed for big data.

84
New cards

What is a key-value database?

Stores data as key → value pairs.

85
New cards

What is a wide column database?

Uses tables with flexible column families (HBase, Cassandra).

86
New cards

What is a document database?

Stores JSON-like documents (MongoDB).

87
New cards

What is a graph database?

Stores nodes, edges, and properties (Neo4j).

88
New cards

What is MongoDB?

A NoSQL document database using BSON and collections.

89
New cards

What does insertOne() do in MongoDB?

Inserts a single document.

90
New cards

What does insertMany() do?

Inserts multiple documents.

91
New cards

What does find() do?

Retrieves all matching documents.

92
New cards

What does updateOne() do?

Updates the first matching document.

93
New cards

What does deleteOne() do?

Deletes the first matching document.

94
New cards

What does show dbs do in Mongo Shell?

Lists all databases.

95
New cards

What is a shard in NoSQL?

A partition of data across servers.