Intro to SQL & Select statements: LMS 18 Flashcards

1
Q

What does SQL stand for?

A

Structured Query Language

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

What is SQL?
(Structured Query Language?)

A

A database computer language

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

What is SQL designed for?

A

Designed to retrieve and manage data.
Also to create and modify DB schema, etc.

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

What is a Database?

A

An organized repository of indexed information.

(usually as a group of linked data files)

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

What does a Database allow?

A

easy retrieval, updating, analysis, and output of data.

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

Where is a data in a database stored?

A

Usually in a computer.

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

What form is the data in?

A

Graphics, reports, scripts, tables, text, etc.

Data could represent almost every kind of information.

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

Examples of computer apps that have data bases at their core.

A

Antivirus software, spreadsheets, word-processors.

Most computer apps are databases at their core.

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

What is a Query?

A

A request to the database to retrieve information.

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

What is a subquery?

A

A query within another query.

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

What is the outer query called?

A

The main query.

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

What is the inner query called

A

Subquery

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

Whats is executed first?
The subquery or main query?

A

The subquery is always executed first, and the results of the subquery are passed on to the main query.

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

What does DBMS stand for?

A

Database Management System

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

What does a DBMS do?

A

It’s a software that controls the organization, storage, retrieval, security, and integrity of data in a database.

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

What is a Primary Key?

A

Its a unique identifier of every record in the database table.

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

Where is the Primary Key?

A

Its a column in a database where each row has a unique value.

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

How many primary keys are in a table?

A

Only one primary key. No NULL values are allowed.

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

What is a Unique Key?

A

It’s a column or group of columns that together hold unique values.

A table can have more than one unique key.

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

In a list of American citizens, there is a column with Social Security Numbers (SSN).
Also First and last name columns combined with phone number.

What is the Primary Key?
What is the Unique key?

A

The column with social security numbers (SSN) would be a Primary Key

The first and last name columns combined with phone number would be a Unique Key.

21
Q

What is a Foreign Key (SQL)?

A

A column or combination of columns that’s used to establish a relationship, linking the table rows to another table’s Primary Key.

22
Q

What is Referential Integrity?

A

Refers to the relationship between tables.

23
Q

What does a Foreign Key do?

A

A Foreign Key enforces the relationship between two tables via the Primary Key of the parent table and the Foreign Key of the development child of the table.

24
Q

Is a Foreign Key unique?

A

A Foreign Key is usually not unique (one-to-many relation) and always points to a Primary Key.

25
Q

What is a SQL Join?

A

An instruction to combine data from two sets of data (i.e. two tables)

26
Q

What is a SQL Join Example?

A

Let’s say we want to find all orders placed by a particular customer. We can do this by joining the customers and orders tables together using the relationship established by the customer id key.

27
Q

What are the types of Joint hat can be used to retrieve data ?

A

Inner Join
Right Join
Left Join
Full Join

28
Q

Define Inner Join

A

Inner Join return rows when there is at least one match of rows between the tables.

29
Q

Define Right Join

A

Right Join return rows that are common between the tables and all rows of the right-hand side table. Simply, it returns all the rows from the right-hand side table even though there are no matches in the left-hand side table.

30
Q

Define Left Join

A

Left Join return rows that are common between the tables and all rows of the left-hand side table. Simply, it returns all the rows from the left-hand side table even though there are no matches in the right-hand side table.

31
Q

Define Full Join

A

Full Join return rows when there are matching rows in any one of the tables. This means that it returns all the rows from the left-hand side table and all the rows from the right-hand side table.

32
Q

What are Tables?

A

A Table is a set of data that is organized in a model with Columns and Rows.

33
Q

What are Fields?

What are Records?

A

A Table has a specified number of Columns called Fields but can have any number of Rows that are called a record.

34
Q

Example of Tables and Fields?

A

Table: Employee.
Field: Emp ID, Emp Name, Date of Birth.
Data: 201456, David, 11/15/1960.

35
Q

What is a Stored Procedure?

A

A Stored Procedure is a function that consists of many SQL statements to access the database system that can be executed whenever required.

36
Q

What does the DELETE command do?

A

A Delete command is used to remove rows from the table.

37
Q

What can a WHERE clause be used for?

A

Can be used for a condiditional set of parameters.

38
Q

When can Commit and Rollback be performed?

A

After a delete statement.

39
Q

What does a TRUNCATE command do?

A

Removes all rows from a table, but the table structure and its columns, constraints, indexes, and so on remain.

40
Q

What is a Constraint

A

A constraint can be used to specify the limit on the data type of table.

41
Q

A constraint can be specified while creating or altering the table statement.

What are samples of constraints?

A
  • NOT NULL
  • CHECK
  • DEFAULT
  • UNIQUE
  • PRIMARY KEY
  • FOREIGN KEY
42
Q

What is CLAUSE?

A

A SQL clause is defined to limit the result set by providing the condition to the query.

43
Q

Examples of Clauses

A

Query that has WHERE condition Query that has HAVING condition.

This usually filters some rows from the whole set of records.

44
Q

What is a database schema?

A

Is the skeleton structure that represents the logical view of the entire database.

Basically, it shows all the tables in the database and how they are connected. You can think about it as a map of the database.

45
Q

What does a database schema define?

A

Defines how the data is organized and how the relations among them are associated. It formulates all the constraints that are to be applied to the data.

46
Q

Structural database testing.

A

It focuses on testing tables and columns, schema testing, checking stored procedures and views, checking triggers, etc.

47
Q

Functional testing

A

It involves testing the functionality of the database from the user’s point of view. The most common type of functional testing is white-box and black-box testing.

48
Q

Non-functional testing.

A

It includes load testing, database risk testing, stress testing, minimum system requirements, and database performance handling.