Database/SQL Flashcards
What is a database?
a database is a collection of information that is organized so that it can be easily accessed, managed and updated.
What is relational database ?
A relational database uses a structure that allows us to identify and access data in relation to another piece of data in the database. usually organized into tables.
What are rows called in databases ?
Records
What is a relational database management system ?
a relational database management system RDBMS, is a program that allows you to create, update, and administer a relational database. Most systems use SQL to access the database.
What is SQL ?
SQL, structured query language, is a programming language used to communicate with data stored in a relational database management system.
Name some uses of SQL
- Allows users to access data in the RDBMS.
- Allows users to describe data
- Allows users to define and manipulate data in a database
- Allows users to set permissions on tables, procedures, and views
What is a primary key ?
A primary key is a field in a table which uniquely identifies each row/record in a database table.
A table can only have one primary key, which may consist of multiple fields. When multiple fields are used a a primary key, they are called a composite key.
What is a foreign key ?
A foreign key is used to link two tables together. This is sometimes called a referencing key.
It’s a column or combination of columns whose values match a primary key in a different table.
Define SQL statements
DDL - Data Definition Language : CREATE, ALTER, DROP
DML - Data Manipulation Language : SELECT, INSERT, UPDATE, DELETE
DCL - Data Control language : GRANT, REVOKE
TCL - Transaction Control Language : SAVEPOINT, ROLLBACK, COMMIT
What is the SELECT Query ?
A SQL SELECT statement is used to fetch the data from a database table which returns this data in the form of a result table. These result tables are called result-sets.
What is SQL WHERE ?
The SQL WHERE clause is used to specify a condition while fetching the data from a single table or by joining with multiple tables. It should be used to filter the records and to fetch only the necessary records.
What is the INSERT Query ?
The INSERT INTO statement is used to add new rows of data to a table in the database.
What is SQL Joins ?
A Joins clause is used to combine records from 2 or more tables in a database.
What are the different types of Joins ?
INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN