SQL Basics
- 35Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What does SQL stand for?
Structured Query Language
Or swipe the card
35 cards
What does SQL stand for?
Structured Query Language
What is the primary use of SQL?
To communicate with databases, performing operations like creating, reading, updating, and deleting data.
What does CRUD stand for in SQL?
Create, Read, Update, Delete
What is a database?
A system for storing large amounts of structured data in tables with rows and columns.
What does DBMS stand for and what is its role?
Database Management System; it manages databases, controlling access and organizing data.
Name three examples of DBMS software.
MySQL, Microsoft SQL Server, PostgreSQL (also Oracle)
Is SQL an ISO standard?
Yes, SQL is a standard ratified by the ISO.
What are the two main types of databases?
Relational (RDBMS) and non-relational (NoSQL).
What makes a relational database 'relational'?
Tables are related to each other through keys (e.g., primary and foreign keys).
How do you install MySQL on Ubuntu?
Run
sudo apt updatethensudo apt install mysql-server -y.How do you verify the MySQL service is running?
Use
sudo systemctl status mysql.How do you access the MySQL command shell?
Type
sudo mysql(ormysql -u root -pif password is set).Why must every MySQL command end with a semicolon?
The semicolon tells MySQL that the command is complete and ready to execute.
How do you list all databases in MySQL?
Run
SHOW DATABASES;How do you create a new database in MySQL?
Run
CREATE DATABASE database_name;How do you switch to a specific database in MySQL?
Run
USE database_name;How do you list all tables in the current database?
Run
SHOW TABLES;How do you create a new table in MySQL?
Run
CREATE TABLE table_name (column_name data_type, ...);What does the INT data type mean in MySQL?
INT is a data type for integers (whole numbers).
What does VARCHAR(n) mean in MySQL?
Variable-length string with a maximum length of n characters.
What is a schema in the context of databases?
The structure and organization of tables and their columns in a database.
How do you view the structure of a table?
Run
DESCRIBE table_name;How do you insert a row into a table in MySQL?
Run
INSERT INTO table_name VALUES (value1, value2, ...);How do you delete specific rows from a table?
Run
DELETE FROM table_name WHERE condition;How do you update existing records in a table?
Run
UPDATE table_name SET column = value WHERE condition;How do you select all columns from a table?
Run
SELECT * FROM table_name;How do you select only specific columns from a table?
Run
SELECT column1, column2 FROM table_name;How do you filter rows in a SELECT query?
Add a WHERE clause:
SELECT * FROM table_name WHERE condition;How do you combine multiple conditions in a WHERE clause?
Use OR (or AND) between conditions:
WHERE condition1 OR condition2How do you select rows where a condition is not true?
Use the NOT operator:
SELECT * FROM table_name WHERE NOT condition;How do you sort query results in ascending or descending order?
Use
ORDER BY column_name ASC(ascending) orDESC(descending).How do you add a new column to an existing table?
Run
ALTER TABLE table_name ADD column_name data_type;What is the purpose of the BOOLEAN data type in MySQL?
To store true/false values.
What is a primary key in a relational database?
A unique identifier for each row in a table (e.g., the ID column).
What is a foreign key?
A column in one table that references the primary key of another table, creating a relationship.

Ask anything
We've read this whole study set, so questions about it get the best answers.