Terminology Flashcards
(30 cards)
What is SQL?
- SQL is a programming language we use to select, modify, and insert data in databases.
- Structured Query Language (SQL) is a programming language used to manage data in a relational database.
What is DATABASE?
- a collection of data that is organized for use by a computer
- databases are collections of tables storing different pieces of data.
- essentially, it’s a structured way to store and manage large amounts of information.
- an organized collection of data, stored electronically, that allows for efficient access, manipulation, and retrieval of information, often structured in tables with rows and columns, enabling users to establish relationships between different data points within the system.
What are TABLES?
Most databases are collections of tables storing different pieces of data.
Tables are like spreadsheets, storing information about a specific kind of data, such as this table storing users’ names and usernames.
What is PRIMARY KEY in databases?
- In many databases, each entry has a unique ID to help identify records easily.
- A primary key is a column or set of columns in a database table that uniquely identifies each row in a table.
What is ATTRIBUTE of the data?
Each column of a table represents a specific attribute of the data, such as id , name , or username .
Relationships between ROWS & COLUMNS: which one stores what?
ROWS - store items
COLUMNS - store properties of each item (like name or email)
What SELECT does?
SELECT statement queries and retrieves data from a database.
How do we pick data from the column?
We code SELECT , followed by the name of the column we want to pick.
Let’s pick the column called Name to select the names’ of our users.
What does this code do:
SELECT name
FROM users;
Finally, we need to define the table we want to query by coding FROM followed by the table’s name.
What do we end an SQL statement with?
Finally, though it might seem minor, it’s important to remember that we end an SQL statement with a semicolon.
What is QUERY?
When requesting data with SQL statements like SELECT , we say that we’re making a query.
How do we tell apart SQL KEYWORDS from column and table names?
To tell apart SQL keywords from column and table names, we write them in upper case. Tap on the code and type FROM .
What does the FROMusers statement do?
SELECT name
FROM users;
It says which table we want to select the name column from.
What keyword do we use to select data from a given table?
SELECT
What (punctuation mark) do we use to select multiple columns from the table?
When selecting multiple columns, we use commas , to separate column names, like here with name,email .
How do we select all columns of a table?
To make things easier, we can select all columns of a table using the select all symbol * instead.
SELECT *
FROM table;
What do we use DISTINCT for?
We can use DISTINCT to only select unique values, removing any duplicates from the results of our query.
SELECT DISTINCT country
FROM table;
When we use the keyword DISTINCT , we eliminate duplicates from the columns we select,
Why do we want to order items in a table?
Understanding data is easier when the items are ordered, like patients ordered by their name .
What do we use ORDER BY keywords?
We use the ORDERBY keywords to order the patients entries according to a property.
After ORDERBY , we code the column by which we want to order the entries, like name .
Which keywords allow us to order selected items?
ORDER BY
What does the FROM keyword do in this query?
SELECT *
FROM countries
ORDER BY name;
It specifies the table we’re selecting from (countries)
How are the items arranged when we order by a column with text values?
Alphabetically, according to their values in that column.
Which item comes first when ordering by a column with numerical values?
The item with the smallest value in that column.
Which item comes first when ordering by a column with numerical values?
The item with the smallest value in that column.