Understanding SQL Flashcards

1
Q

What does SQL stand for?

A

Structured Query Language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is SQL used for?

A

To communicate with and operate databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is SQL important for relational databases?

A

It provides the commands to create, manage, and query relational databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Is SQL only used for relational databases?

A

Primarily yes, but similar query languages exist for other types of databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List three main functions of SQL.

A

Database design, data manipulation, and reporting (querying).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the categories of SQL commands?

A

Database Design-Construction, Data Manipulation, Reporting (querying), Data Control, Transaction Control, Miscellaneous Commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is it useful to categorize SQL commands?

A

It helps understand the different roles and operations SQL performs in managing a database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What command connects to MySQL from the command line?

A

mysql -u user_name -p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain the ‘-u’ and ‘-p’ options in the MySQL command.

A

‘-u’ specifies the username, and ‘-p’ prompts for the password.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens if you forget to use ‘-p’ in the MySQL command?

A

MySQL will attempt to connect without prompting for a password, which may fail if authentication is required.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If you want to create tables and define relationships, which SQL category do you use?

A

Database Design-Construction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you need to update data inside your tables, which category of SQL commands do you use?

A

Data Manipulation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When you want to extract and summarize data, which category of SQL commands should you use?

A

Reporting (querying).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Spot the mistake: ‘sql -u user_name -p’

A

Command should be ‘mysql -u user_name -p’ (missing ‘mysql’).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Spot the mistake: ‘SQL is a database management system.’

A

Incorrect. SQL is a language, not a database management system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which language is designed to manage and query data in relational databases?

A

SQL (Structured Query Language).

17
Q

What language allows us to manipulate and report data in a database?

18
Q

Explain in your own words why SQL is essential for databases.

A

SQL provides the structure and syntax to define, manipulate, and retrieve data effectively from databases.

19
Q

Describe what happens when you execute ‘mysql -u user_name -p’.

A

You initiate a connection to MySQL, specifying your username and being prompted for your password.

20
Q

If you fail to understand the categories of SQL commands, what risk arises?

A

You might misuse commands, leading to errors in design, data manipulation, or reporting.

21
Q

If you use SQL without authentication, what security risk appears?

A

Unauthorized access to your database, leading to potential data breaches.