Module 7 - SQL Basics for Data Science

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/58

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.

59 Terms

1
New cards

What does SQL stand for?

Structured Query Language

2
New cards

Which of the following is a primary use of SQL?

Querying data efficiently

3
New cards

Is a language used to interact with relational databases.

SQL

4
New cards

Which type of SQL command is used to modify data in a database?

DML (Data Manipulation Language)

5
New cards

Which SQL command type is used to define the database structure?

DDL (Data Definition Language)

6
New cards

The SELECT command falls under which category?

DQL (Data Query Language

7
New cards

Which SQL command type controls access to the database?

DCL (Data Control Language)

8
New cards

Which of the following is an example of a DDL command?

CREATE

9
New cards

Which of the following is an example of a DML command?

UPDATE

10
New cards

Which of the following is an example of a DCL command?

GRANT

11
New cards

Which SQL command type is used for querying data?

DQL (Data Query Language)

12
New cards

Is a free, feature-rich edition of SQL Server designed for
learning, developing, and powering desktop, web, and small server applications

Microsoft SQL Server 2022 Express

13
New cards

It allows users to access, configure, administer, monitor, and develop SQL components,
generate and execute Transact-SQL (T-SQL) queries, view and edit data, and manage
databases through a graphical interface and script editors.

SQL Server Management Studio (SSMS)

14
New cards

What does SSMS stand for?

SQL Server Management Studio

15
New cards

What is the primary function of SSMS?

To generate and execute Transact-SQL (T-SQL) queries and manage databases

16
New cards

When connecting via SSMS, what should the "Server type" be set to?

Database Engine

17
New cards

For a local SQL Server Express instance, what is the typical "Server name"?

localhost\SQLEXPRESS

18
New cards

What is the typical "Authentication" mode used when connecting via SSMS in the module?

Windows Authentication

19
New cards

True or False:

SQL keywords are case-sensitive.

False

20
New cards

According to the module's conventions, how should SQL keywords be written for better readability?

UPPERCASE

21
New cards

How should a SQL statement be terminated in a script?

With a semicolon (;)

22
New cards

How should string or text values be enclosed in a SQL statement?

Single quotes (')

23
New cards

What is the purpose of the SELECT clause?

To specify the columns to display

24
New cards

What is the purpose of the FROM clause?

To specify the table to retrieve data from

25
New cards

What is the purpose of the WHERE clause?

To filter rows based on a condition

26
New cards

What is the purpose of the ORDER BY clause?

To sort the results

27
New cards

In which order must these clauses appear in a SQL query?

SELECT, FROM, WHERE, ORDER B

28
New cards

Which symbol is used for a single-line comment in SQL?

--

29
New cards

Which symbols are used for a multi-line comment in SQL?

/* and */

30
New cards

What is the correct SQL command to create a database named UniversityDB?

CREATE DATABASE UniversityDB;

31
New cards

After creating a database, what command is used to start working with it?

USE

32
New cards

The IDENTITY(1,1) property in a column definition means:

The column will auto-increment, starting at 1 and incrementing by 1.

33
New cards

What keyword defines a column that uniquely identifies each row in a table?

PRIMARY KEY

34
New cards

In the Enrollments table, what does the StudentID INT FOREIGN KEY REFERENCES Students(StudentID) line do?

It creates a link between the Enrollments and Students tables, ensuring a valid StudentID.

35
New cards

According to the lab activity, what is another way to create a table without running a SQL command?

Using the Object Explorer Window in SSMS

36
New cards

Is this SQL statement correct for inserting a new product?

INSERT INTO Products (ProductName, Category, Price)

VALUES ('Smartphone', 'Electronics', 20999.00);

Correct

37
New cards

Is this SQL statement correct for inserting a new product?

INSERT INTO Products (ProductName, Category, Price)
VALUES (Smartphone, Electronics, 20999.00);

Incorrect

38
New cards

What is the correct SQL command to view all records from the Products table?

SELECT * FROM Products;

39
New cards

True or False:

The WHERE clause is used to filter columns.

False

40
New cards

You want to find all products with a Quantity greater than 10. Which query is correct?

SELECT * FROM Products WHERE Quantity > 10;

41
New cards

You want to find all products in the 'Electronics' category. Which query is correct?

SELECT * FROM Products WHERE Category = 'Electronics';

42
New cards

You want to find all products added on or after September 1, 2025. Which query is correct?

SELECT * FROM Products WHERE DateAdded >= '2025-09-01';

43
New cards

The AND operator is used to retrieve records where...

All specified conditions are true.

44
New cards

The OR operator is used to retrieve records where...

At least one of multiple conditions is true.

45
New cards

You want to find products with a Quantity greater than 5 AND a Price less than 5000. Which WHERE clause is correct?

WHERE Quantity > 5 AND Price < 5000

46
New cards

You want to find products that are in either the 'Electronics' or 'Office' category. Which WHERE clause is correct?

WHERE Category = 'Electronics' OR Category = 'Office'

47
New cards

The NOT operator is used to...

Negate a condition.

48
New cards

You want to find all products that are not in the 'Accessories' category. Which query is correct?

All of the above are correct.

49
New cards

The LIKE operator is used for...

Pattern matching with wildcards.

50
New cards

The % wildcard in a LIKE pattern represents...

Any sequence of zero or more characters.

51
New cards

You want to find all suppliers whose name starts with 'Tech'. Which WHERE clause is correct?

WHERE Supplier LIKE 'Tech%'

52
New cards

You want to find all product names that contain the letter 'o'. Which WHERE clause is correct?

WHERE ProductName LIKE '%o%'

53
New cards

The IS NULL operator is used to check for...

Missing or undefined values

54
New cards

You want to find all products where the Supplier information is missing. Which query is correct?

SELECT * FROM Products WHERE Supplier IS NULL;

55
New cards

The IN operator is used to...

Check if a value matches any value in a list.

56
New cards

You want to find products in the 'Office' or 'Accessories' category. Which WHERE clause is correct using IN?

WHERE Category IN ('Office', 'Accessories')

57
New cards

The BETWEEN operator is used to...

Check if a value is within a specified range (inclusive).

58
New cards

Which operator means "Not Equal To"?

<> or !=

59
New cards

Which operator checks if a value is less than or equal to another?

<=