Database Flashcards

1
Q

What is a database?

A

A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). Together, the data and the DBMS, along with the applications that are associated with them, are referred to as a database system, often shortened to just database.

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

What are different types of databases?

A

There are many different types of databases. The best database for a specific organization depends on how the organization intends to use the data. Examples of different database types include Relational databases, Distributed databases, Data warehouses, NoSQP databases, and OLTP databases.

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

What is a Relational database?

A

Relational databases are a type of database in which items are organized as a set of tables with columns and rows. Relational database technology provides the most efficient and flexible way to access structured information.

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

What is a Distributed database?

A

A distributed database consists of two or more files located in different sites. The database may be stored on multiple computers, located in the same physical location, or scattered over different networks.

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

What is a Data warehouse?

A

A data warehouse is a central repository for data. It is a type of database specifically designed for fast query and analysis.

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

What is a NoSQL database?

A

A NoSQL, or non relational database, allows unstructured and semistructured data to be stored and manipulated (in contrast to a relational database, which defines how all data inserted into the database must be composed).

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

What is a OLTP database?

A

An OLTP databse is a speedy, analytic database designed for large numbers of transactions performed by multiple users.

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

What is a Database Management System?

A

A Database Management System is the software that interacts with the users, application programs, and the database. It helps makes data management more efficient and effective, provides end users better access to more and better-managed data, promotes an integrated view of the organization’s operations, and reduces the probability of inconsistent data.

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

What is SQL?

A

SQL stands for Structured Query Language. It is the language we used to communicate with the Database System.

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

What are the categories that SQL functions fit into?

A

SQL functions fit into two broad categories. Data definition language, (DDL), which includes commands to create Database objects such as tables, indexes, and views. The other category, Data manipulation language (DML), includes commends to insert, update, delete, and retrieve data within the database tables.

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

What does the CREATE SCHEMA AUTHORIZATION do?

A

It creates a database schema.

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

What does the CREATE TABLE command do?

A

It creates a new table in the user’s database schema.

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

What does the NOT NULL command do?

A

Constraint that ensures that a column will not have null values.

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

UNIQUE

A

Constraint that ensures that a column will not have duplicate values.

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

What does the PRIMARY KEY command do?

A

Defines a primary key for a table.

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

What does the FOREIGN KEY command do?

A

It defines a foreign key for a table.

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

What does the DEFAULT command do?

A

It defines a default value for a column (when no value is given).

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

What does the CHECK command do?

A

It is a constraint used to validate data in a column.

19
Q

What does the CREATE INDEX command do?

A

It creates an index for a table.

20
Q

What does the CREATE VIEW command do?

A

It creates a dynamic subset of rows/columns from one or more tables.

21
Q

What does the ALTER TABLE command do?

A

It modifies a table’s definition (adds, modifies, or deletes attributes or constraints).

22
Q

What does the CREATE TABLE AS command do?

A

It creates a new table based on a query in the user’s database schema.

23
Q

What does the DROP TABLE command do?

A

It permanently deletes a table (and thus its data).

24
Q

What does the DROP INDEX command do?

A

It permanently deletes an index.

25
Q

What does the DROP VIEW command do?

A

Permanently deletes a view.

26
Q

What does the INSERT command do?

A

It lets insert data into table, one row at a time. Used to make the initial data entries into a new table structure to to add data to a table that already contains data.

27
Q

What does the SELECT function do?

A

The SELECT statement is used to select data from a database.

The data returned is stored in a result table, called the result-set.

28
Q

What does the COMMIT function do?

A

It lets you permanently save your work to disk.

29
Q

What does the UPDATE function do?

A

It enables you to make changes to column values in one or more data rows.

30
Q

What does the ROLLBACK function do?

A

It restores the database table contents to their original condition (since the last COMMIT).

31
Q

What does the DELETE function do?

A

Enables you to delete one or more data rows.

32
Q

What does the SQL WHERE Clause do?

A

The WHERE clause is used to filter records.

It is used to extract only those records that fulfill a specified condition.

33
Q

What are the SQL AND, OR and NOT Operators?

A

The WHERE clause can be combined with AND, OR, and NOT operators.

The AND and OR operators are used to filter records based on more than one condition:

The AND operator displays a record if all the conditions separated by AND are TRUE.
The OR operator displays a record if any of the conditions separated by OR is TRUE.

The NOT operator displays a record if the condition(s) is NOT TRUE.

34
Q

What does the SQL ORDER BY Keyword do?

A

The ORDER BY keyword is used to sort the result-set in ascending or descending order.

The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

35
Q

What does the SQL INSERT INTO Statement do?

A

The INSERT INTO statement is used to insert new records in a table.

36
Q

What is Database Testing?

A

Database Testing is ensuring that data entered in the Front End or directly into the database tables, it should be stored properly on the Back End. Similarly, if you call the stored record from the Front End, it should display properly.

Validate existence of values in database tables.
Validate correctness of values in database tables.
Validate completeness of values in database tables.

37
Q

What are SQL Data types?

A

You have numeric data types, which include integer, small-int, and decimal (L, D). You have character data types, which in char(L) and varChar(L). Finally you have the date data types.

38
Q

What are Primary Keys?

A

The Primary Key constraint uniquely identifies each record on a table. The Primary Key must contain unique values, and not any null values. A table can have one or more Primary Keys, the additional keys being called composite keys.

39
Q

What are the Aggregate Functions in SQL?

A

COUNT - counts how many rows are in a particular column
SUM - adds together all the values in a particular column
MIN/MAX - returns the lowest or highest values in a particular column
AVG - calculates the average of a group of selected values

40
Q

What is an SQL JOIN Clause?

A

A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

41
Q

What are different types of SQL JOINS?

A

INNER JOIN keyword - selects records that have matching values in both tables.
LEFT JOIN keyword - returns all records from the left table (table1), and the matching records from the right table (table2).
RIGHT JOIN keyword - returns all records from the right table (table2), and the matching records from the left table (table1).

42
Q

What is the SQL UNION Operator?

A

The UNION operator is used to combine the result-set of two or more SELECT statements.

Every SELECT statement within UNION must have the same number of columns
The columns must also have similar data types
The columns in every SELECT statement must also be in the same order
43
Q

What is an SQL Constraint?

A

SQL Constraints are used to specify rules for data in a table. Constraints are used to limit the data types that can go in a table. This ensures the accuracy and reliability of the data in the table. Constraints can be column-wide or table-wide.

44
Q

What are examples of SQL Constraints?

A

Not null, unique, primary key, foreign key, check, default, and index.