SQL Flashcards
What is SQL
Standard for managing data kept in relational database management systems
What is MySQL
Open source relational database management system
What are Joins?
Right, left, inner, and full joins combine rows from two or more tables
Index
An index is a pointer to data contained within a table which allows for faster retrieval of records
Constraints
Specify a rule for the data within a table limiting the type of data that can go within
Type of Constraints
Primary key - identifies each record in a table
Not Null - used to prevent a Null value
Foreign Key - provides a unique identification of a row or record within another table
Default - automatically assigns a default value if there has not been a value already specified for a field
Check - used to verify that all values meet a specific criteria or condition in a field
Unique - ensures unique values are always inserted into a column
Index - used to create data and to obtain it from a database
What are a Table and Field
Table: a collection of data that is organized into rows and columns
Columns are called fields and rows are records
Data Control Language (DCL)
permits you to control access to the database
Data Definition Language (DDL)
allows you to specify data structure in the database including deleting tables, creating them, or altering them
Data Manipulation Language (DML)
allows you to manipulate data, update, insert, delete, or retrieve
How to format SQL dates
Format function (SELECT FORMAT getDate(), ‘dd/MM/yyyy’)
Primary Key
A primary key is used to ensure data in the specific column is unique and uniquely identifies a record in the relational database.
Foreign Key
A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables.
It refers to the field in a table which is the primary key of another table.
What is Database denormalization
Is a method used to improve the performance of a database, allowing the retrieval of data in the quickest time possible.
Adds redundant database data into a table which in turn enables the performance of databases to improve, as the same data can be put in several places.
Subquery
Subquery is a query nested inside a larger query