Study Day One Flashcards

1
Q

What is Database?

A

A structured collection of data organized and stored into a computer. Designed to efficiently to manage, store, retrieve, and manipulate vast amounts of data.

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

What is DBMS (Database Management System?

A

A Database Management System (DBMS) is software that provides an interface and tools for creating, managing, and interacting with databases.

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

What is RDBMS? How is it different from DBMS?

A

It is a specific type of DBMS that organizes data into tables with rows and columns, and it manages the relationships between these tables.
DBMS: Not restricted structure, relationships between data not explicitly defined, data integrity is not as strictly enforced, schema may be dynamic and change frequently
RDBMS: Organized tables with relationships between them, well defined relationships, strict data integrity rules, fixed schema

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

What is SQL?

A

SQL (Structured Query Language) is a domain-specific language used to communicate with and manipulate relational databases.

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

What is the difference between SQL and MySQL?

A

SQL is a language used to interact with relational databases, while MySQL is a specific database management system that implements the SQL language.

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

What are Tables and Fields?

A

A table is a component in a database that represents data organized into rows and columns.
A Field or Attributes are the individual data elements that make up the columns in a table.

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

What are Constraints in SQL?

A

Rules and conditions that are applied to the columns or tables in a database to maintain data integrity
NO NULL
UNIQUE
PRIMARY KEY (Combines not null and unique)
FORIGN KEY
CHECK
DEFAULT

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

What is a Primary Key?

A

A special column or set of columns that uniquely identifies that record. A table can only have one primary key and can not be null.

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

What is a UNIQUE constraint?

A

Ensures that the values in a column or set of columns are unique across all the records in a table

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

What is a Foreign Key?

A

It is a column or a set of columns in one table that references the primary key of another table. The number can very from one to many.

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

What is a JOIN, describe different types.

A

Used to combine rows from two or more tables based on a related column(s) between them.
INNER JOIN - returns only the rows that have matching values
LEFT JOIN(LEFT OUTER JOIN) - Returns all the rows from the first table and the matching rows from the second
RIGHT JOIN(RIGHT OUTER JOIN) - Returns all the rows from the second table and the match rows from the first
FULL JOIN(FULL OUTER JOIN) - Returns all the rows when there is a match in either
CROSS JOIN - Combines each row from the first with every row from the second
SELF JOIN - Creates relations between records on the same table.

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

What is an Index?

A

Reference to the physical location of rows int a table improving the speed of data retrieval

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

What is the difference between Clustered and a Non-clustered index?

A

Clustered Index: The physical order of the rows in the table is determined by the clustered index, and there can be only one per table. Well-suited for range queries and exact match queries on the indexed column(s).
Non-clustered Index: Creates a separate data structure to hold the indexed column(s) and pointers to the corresponding rows in the table.

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

What is a Query?

A

A request for information or specific action issued to a DBMS

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

What is an Alias in SQL?

A

User-defined alternative name given to a table or column in a query. Allowing you to temporarily rename a table or column.

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

What is Normalization?

A

Used to organize and structure relational databases in a way that reduces data redundancy and ensure data integrity. This can be down by breaking down large tables into smaller organized tables with clear relationships.

17
Q

What are the various forms of Normalization?

A

1NF: It eliminates repeating groups by organizing data into simple, single-valued attributes. One Value per Field
2NF: To achieve 2NF, tables must be in 1NF, and the primary key must consist of a single column. Table has a primary key
3NF: It ensures that non-key attributes are not dependent on other non-key attributes. No duplicate fields across tables

18
Q

What are the TRUNCATE, DELETE, and DROP statements?

A

All used to remove data from the database.
Truncate is used to remove all the rows from a table (Data Definition Language)
Delete is used to remove specific rows or all rows from a table (DML statement)
Drop is used to remove database objects such as tables, views, indexes, or even entire databases from the database system. (DDL)

19
Q

What are Aggregate functions?

A

Are functions that perform calculations on a set of rows and return a single result summarizing the data.
COUNT
SUM
AVG
MAX
MIN

20
Q

What is a Stored Procedure?

A

A named and precompiled set of SQL statements and procedural logic that is stored in the database. It is a database object that can be invoked and executed multiple times with different parameters. Manage a database efficiently by providing code reusability, performance optimization , security, and data consistency

21
Q

What is a Recursive Stored Procedure?

A

Type of stored procedure in a database that calls itself during its execution. Used on tables that have a hierarchical data structure of categories.

22
Q

What is Pattern Matching in SQL?

A

The ability to search and identify specific patterns or substrings within character strings stored in the database. Allow you to perform complex searches based on wildcards and regular expressions.

23
Q

What is CLAUSE in SQL?

A

Specific and distinct part of a SQL statement that serves a particular purpose in querying or modifying data in a database.

24
Q

How can you select unique records from a table?

A

Use the DISTINCT keyword with the SELECT statement. The DISTINCT keyword instructs the database to eliminate duplicate rows from the result set, returning only the distinct or unique records.

25
Q

What is a View?

A

A virtual table derived from the result of a SELECT query. Can be used to hide table data if needed.