Terminology Flashcards

(30 cards)

1
Q

What is SQL?

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is DATABASE?

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are TABLES?

A

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.

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

What is PRIMARY KEY in databases?

A
  • 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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is ATTRIBUTE of the data?

A

Each column of a table represents a specific attribute of the data, such as i⁠d⁠ , n⁠a⁠m⁠e⁠ , or u⁠s⁠e⁠r⁠n⁠a⁠m⁠e⁠ .

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

Relationships between ROWS & COLUMNS: which one stores what?

A

ROWS - store items
COLUMNS - store properties of each item (like name or email)

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

What SELECT does?

A

S⁠E⁠L⁠E⁠C⁠T⁠ statement queries and retrieves data from a database.

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

How do we pick data from the column?

A

We code S⁠E⁠L⁠E⁠C⁠T⁠ , followed by the name of the column we want to pick.
Let’s pick the column called Nam⁠e⁠ to select the names’ of our users.

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

What does this code do:
SELECT name
FROM users;

A

Finally, we need to define the table we want to query by coding F⁠R⁠O⁠M⁠ followed by the table’s name.

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

What do we end an SQL statement with?

A

Finally, though it might seem minor, it’s important to remember that we end an SQL statement with a semicolon.

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

What is QUERY?

A

When requesting data with SQL statements like S⁠E⁠L⁠E⁠C⁠T⁠ , we say that we’re making a query.

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

How do we tell apart SQL KEYWORDS from column and table names?

A

To tell apart SQL keywords from column and table names, we write them in upper case. Tap on the code and type F⁠R⁠O⁠M⁠ .

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

What does the F⁠R⁠O⁠M⁠u⁠s⁠e⁠r⁠s⁠ statement do?

SELECT name
FROM users;

A

It says which table we want to select the name column from.

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

What keyword do we use to select data from a given table?

A

SELECT

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

What (punctuation mark) do we use to select multiple columns from the table?

A

When selecting multiple columns, we use commas ,⁠ to separate column names, like here with n⁠a⁠m⁠e⁠,⁠e⁠m⁠a⁠i⁠l⁠ .

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

How do we select all columns of a table?

A

To make things easier, we can select all columns of a table using the select all symbol *⁠ instead.

SELECT *
FROM table;

17
Q

What do we use DISTINCT for?

A

We can use D⁠I⁠S⁠T⁠I⁠N⁠C⁠T⁠ to only select unique values, removing any duplicates from the results of our query.

SELECT DISTINCT country
FROM table;

When we use the keyword D⁠I⁠S⁠T⁠I⁠N⁠C⁠T⁠ , we eliminate duplicates from the columns we select,

18
Q

Why do we want to order items in a table?

A

Understanding data is easier when the items are ordered, like p⁠a⁠t⁠i⁠e⁠n⁠t⁠s⁠ ordered by their n⁠a⁠m⁠e⁠ .

19
Q

What do we use ORDER BY keywords?

A

We use the O⁠R⁠D⁠E⁠R⁠B⁠Y⁠ keywords to order the p⁠a⁠t⁠i⁠e⁠n⁠t⁠s⁠ entries according to a property.

After O⁠R⁠D⁠E⁠R⁠B⁠Y⁠ , we code the column by which we want to order the entries, like n⁠a⁠m⁠e⁠ .

20
Q

Which keywords allow us to order selected items?

21
Q

What does the F⁠R⁠O⁠M⁠ keyword do in this query?

SELECT *
FROM countries
ORDER BY name;

A

It specifies the table we’re selecting from (countries)

22
Q

How are the items arranged when we order by a column with text values?

A

Alphabetically, according to their values in that column.

23
Q

Which item comes first when ordering by a column with numerical values?

A

The item with the smallest value in that column.

24
Q

Which item comes first when ordering by a column with numerical values?

A

The item with the smallest value in that column.

25
How do we order items in descending order?
By coding DESC keyword after the column name.
26
What is FOREIGN KEY?
- is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in another table. - The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table. - Primary keys serve as unique identifiers for each row in a database table. - Foreign keys link data in one table to the data in another table. A foreign key column in a table points to a column with unique values in another table (often the primary key column) to create a way of cross-referencing the two tables.
27
Which operator do we use to check if two values are not equal?
<>
28
What is TRUNCATING?
You can also delete the data of an entire table by not specifying the condition. This is known as truncating. DELETE FROM table;
29
What I⁠N⁠S⁠E⁠R⁠T⁠ I⁠N⁠T⁠O⁠ used for?
 I⁠N⁠S⁠E⁠R⁠T⁠ I⁠N⁠T⁠O⁠ inserts a new row filled with new data in an existing table.
30
What VALUES used for?
V⁠A⁠L⁠U⁠E⁠S⁠ lets you add specific data to the newly added row.