Understanding SQL Flashcards
What does SQL stand for?
Structured Query Language.
What is SQL used for?
To communicate with and operate databases.
Why is SQL important for relational databases?
It provides the commands to create, manage, and query relational databases.
Is SQL only used for relational databases?
Primarily yes, but similar query languages exist for other types of databases.
List three main functions of SQL.
Database design, data manipulation, and reporting (querying).
What are the categories of SQL commands?
Database Design-Construction, Data Manipulation, Reporting (querying), Data Control, Transaction Control, Miscellaneous Commands.
Why is it useful to categorize SQL commands?
It helps understand the different roles and operations SQL performs in managing a database.
What command connects to MySQL from the command line?
mysql -u user_name -p
Explain the ‘-u’ and ‘-p’ options in the MySQL command.
‘-u’ specifies the username, and ‘-p’ prompts for the password.
What happens if you forget to use ‘-p’ in the MySQL command?
MySQL will attempt to connect without prompting for a password, which may fail if authentication is required.
If you want to create tables and define relationships, which SQL category do you use?
Database Design-Construction.
If you need to update data inside your tables, which category of SQL commands do you use?
Data Manipulation.
When you want to extract and summarize data, which category of SQL commands should you use?
Reporting (querying).
Spot the mistake: ‘sql -u user_name -p’
Command should be ‘mysql -u user_name -p’ (missing ‘mysql’).
Spot the mistake: ‘SQL is a database management system.’
Incorrect. SQL is a language, not a database management system.
Which language is designed to manage and query data in relational databases?
SQL (Structured Query Language).
What language allows us to manipulate and report data in a database?
SQL.
Explain in your own words why SQL is essential for databases.
SQL provides the structure and syntax to define, manipulate, and retrieve data effectively from databases.
Describe what happens when you execute ‘mysql -u user_name -p’.
You initiate a connection to MySQL, specifying your username and being prompted for your password.
If you fail to understand the categories of SQL commands, what risk arises?
You might misuse commands, leading to errors in design, data manipulation, or reporting.
If you use SQL without authentication, what security risk appears?
Unauthorized access to your database, leading to potential data breaches.