Introduction Flashcards

1
Q

What is SQL meaning?

A

Structured Query Language

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

How to select the id field from the users table?

A

SELECT id FROM users

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

Which languages use SQL?

A

SQLite, PostgreSQL, MySQL, Oracle

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

Which languages use NoSQL?

A
  • MongoDB
  • Redis
  • ElasticSearch
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Create the people table with the following fields:
id - Integer
name - Text
age - Integer

A

CREATE TABLE people (id INTEGER, name TEXT, age INTEGER)

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

How to rename table “employees” to “contractors”?

A

ALTER TABLE employees RENAME TO contractors;

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

How to rename column “salary” to “invoice” in table “employees”?

A

ALTER TABLE employees RENAME COLUMN salary TO invoice;

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

How to add column “job_title” of type TEXT to table “contractors”?

A

ALTER TABLE employees ADD COLUMN job_title TEXT;

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

How to delete column “is_manager” from table “contractors”?

A

ALTER TABLE employees DROP COLUMN is_manager

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

What is a migration?

A

A database migration is a set of changes to a relational database

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

Will database migrations often be coupled with application code updates?

A

YES

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

What DOWN migrations are necessary for?

A

For roll backs
They revert the UP migrations

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

How is a ‘true’ boolean value stored and presented in SQLite?

A

1

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

Which function is used to get the length of a TEXT column?

A

LENGTH
e.g. LENGTH(description)

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

What value takes a cell whose value is missing?

A

NULL

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

Is NULL value different from a zero value?

A

YES

16
Q

What is a database constraint?

A

A constraint is a rule we create on a database that enforces some specific behavior.

17
Q

Mention some of the most popular database constraints

A
  1. PRIMARY KEY
  2. NOT NULL
  3. UNIQUE
  4. FOREIGN KEY
18
Q

What is a database schema?

A

A description of how data is organized within the database