Midterm exam for IT Database management systems

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

1/66

encourage image

There's no tags or description

Looks like no tags are added yet.

67 Terms

1
New cards

what does the symbol % represent in LIKE pattern?

Any number of characters (zero or more)

2
New cards

What does the underscore _ represent?

Exactly one character

3
New cards

The pattern address LIKE 'H%' means:

Starts with H

4
New cards

The pattern address LIKE 'H___' means:

Exactly 4 characters, starts with H

5
New cards

What does the note say about 'H%'?

Starts with H

6
New cards

The pattern address LIKE '%e' means:

Ends with the letter e

7
New cards

Which values match address LIKE '%e'?

Apple, Home, House

8
New cards

The pattern '%e' requires the value to be at least 1 character long.

True

9
New cards

Which values do not match address LIKE '%e'?

Appley, Hi

10
New cards

What is address LIKE '%Staff%' ?

Contains “Staff anywhere“ in the text

11
New cards

What does NOT LIKE 'H%' return?

Does not start with H

12
New cards

SELECT

retrive/get data from a table

13
New cards

COUNT(*)

counts all rows

14
New cards

Which data type can COUNT , MIN and MAX be used with?

numeric + nonnumeric

15
New cards

What does the ORDER BY clause do?

Sorts the results of your SQL query

16
New cards

How many columns can you sort by with ORDER BY?

One or more columns

17
New cards

ASC

Ascending order (small to large)

18
New cards

DESC mean?

Descending order (large to small)

19
New cards

Which data type can SUM and AVG be used with?

Numeric

20
New cards

__________ can be used in SELECT and HAVING

Aggregate functions

21
New cards

What are the five aggregate functions?

COUNT(), SUM(), AVG(), MIN(), MAX().

22
New cards

Aggregate functions normally return?

one result

23
New cards

Does DISTINCT affect MIN() and MAX()?

No, DISTINCT has no effect.

24
New cards

Does DISTINCT affect SUM() and AVG()?

Yes, it can affect both.

25
New cards

Which aggregate functions can be affected by DISTINCT?

SUM() and AVG()

26
New cards



27
New cards

What does GROUP BY do?

Puts rows with the same value into groups

28
New cards

How many summary rows does GROUP BY give you?

One summary row for each group

29
New cards

Which columns can you use with GROUP BY in a SELECT statement?

Columns listed in GROUP BY and aggregate functions

30
New cards

What else can you use in SELECT with GROUP BY?

Aggregate functions like COUNT(), SUM(), AVG(), MIN(), and MAX().

31
New cards

Any column name in SELECT must also be in GROUP BY, unless?

It is inside an aggregate function like COUNT() or SUM()

32
New cards

Can GROUP BY have extra columns that are not shown in SELECT?

True

33
New cards

If you use WHERE with GROUP BY, what happens first?

WHERE filters the rows

34
New cards

What is the correct order of clauses when using WHERE and GROUP BY in SQL?

SELECT → FROM → WHERE → GROUP BY

35
New cards

What does WHERE do before GROUP BY?

Filters the rows

36
New cards

What happens after WHERE filters the rows?

GROUP BY then groups the remaining rows

37
New cards

Where does HAVING come in a query?

After GROUP BY

38
New cards

What is HAVING commonly used with?

Aggregate functions

39
New cards

What does WHERE filter?

Individual rows

40
New cards

What does HAVING filter?

Groups

41
New cards

What is the correct order of SQL clauses when using WHERE, GROUP BY, and HAVING?

SELECT → FROM → WHERE → GROUP BY → HAVING

42
New cards

What is a subquery?

A SELECT statement inside another SELECT statement.

43
New cards

The query inside another query. It runs first.

Inner Query

44
New cards

The main query that uses the inner query's results.

outer query

45
New cards

Where can subqueries be used?

In the WHERE and HAVING clauses.

46
New cards

Which subquery returns one row and one column?

Scalar subquery

47
New cards

Which subquery returns one row with multiple columns?

Row subquery

48
New cards

Which subquery returns multiple rows and one or more columns?

Table subquery

49
New cards

The five main components of a DBMS environment are:

Hardware, software, Data, procedures, and people

50
New cards

Which component of a DBMS is used for retrieving and updating data?

DML

51
New cards

Which component of a DBMS is used for defining the database structure and controlling access?

DDL

52
New cards

Which operator means “not equal to” in SQL?

<>

53
New cards

What does the DATE data type store?

year-month-day (yyyy-mm-dd)

54
New cards

What does the <= operator mean?

Less than or equal to

55
New cards

What does the > operator mean?

Greater than

56
New cards

An SQL schema is identified by:

A schema name and authorization identifier

57
New cards

List the 4 major advantages of a DBMS

Data independence, Reduced data duplication / controlled redundancy, and Controlled access and integrity

58
New cards

List the 4 major disadvantages of a DBMS?

High cost, complexity, Performance overhead / resource and Size and resource use.

59
New cards

Why can a DBMS be complex?

It requires specialized knowledge to manage

60
New cards

When might a DBMS be slower than a file-based system?

For very simple applications

61
New cards

External level

The user's view of the database; shows the data a specific user needs.

62
New cards

Conceptual Level

The overall view of the database; shows what data is stored and how it is related.

63
New cards

Internal Level

Shows how the database is physically stored on the computer.

64
New cards

JOIN

uses a common column to match rows between 2 tables.

65
New cards

NATURAL JOIN

automatically matches columns with the same name.

66
New cards

What are the three types of OUTER JOIN?

LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.

67
New cards

FULL OUTER JOIN?

Combines everything from the left and right table, including matching and unmatched rows.