Database/SQL Flashcards
A _________ is a collection of information that is organized so that it can be easily accessed, managed and updated.
database
A _________ database is a type of database. It uses a structure that allows us to identify and access data in relation to another piece of data in the database.
relational
Often, data in a ________ database is organized into tables.
relational
Tables can have hundreds, thousands, sometimes even millions of rows of data. These rows are often called ______.
records
_______ are labeled with a descriptive name (say, age for example) and have a specific _____ _____.
Columns are labeled with a descriptive name (say, age for example) and have a specific data type.
A ______ _______ ______ ______ (_____) is a program that allows you to create, update, and administer a relational database
relational database management system (RDBMS)
What does SQL stand for?
Structured Query Language
___ (________ _____ ________) is a programming language used to communicate with data stored in a relational database management system
SQL (Structured Query Language)
SQLite is a relational database management system
True or False
True
_____ contains a minimal set of SQL commands (which are the same across all RDBMSs). Other RDBMSs may use other variants.
SQLight
Why do we need SQL?
1.
2.
3.
4.
5.
6.
7.
- Allows users to access data in the relational database management systems.
- Allows users to describe the data.
- Allows users to define the data in a database and manipulate that data.
- Allows to embed within other languages using SQL modules, libraries & pre-compilers.
- Allows users to create and drop databases and tables.
- Allows users to create view, stored procedure, functions in a database.
- Allows users to set permissions on tables, procedures and views.
Describe a simple SQL Architecture


A _____ ___ is a field in a table which uniquely identifies each row/record in a database table.
primary key
Primary keys must contain ______ ______.
Unique Values
A primary key column can have NULL values.
True or False
False
A primary key cannot have NULL values
A table can have only one primary key
True or False
True
A primary key can only consist of a single field.
True or False
False
A primary key may consist of a single or multiple keys.
When multiple fields are used as a primary key, they are called a ________ ___.
composite key
If a table has a primary key defined on any field(s), then you can have two records having the same value of that field(s).
True or False
False
If a table has a primary key defined on any field(s), then you cannot have two records having the same value of that field(s).
Generally, the primary key is created while creating the database and the table.
True or False
True
The primary key can’t be created after the creation of the table as shown below.
True or False
False
The primary key can also be created after the creation of the table as shown below.
Set a primary key on this column ID
CREATE TABLE CUSTOMERS(
ID INT NOT NULL, // To set a primary key on this column ID
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
ALTER TABLE CUSTOMER ADD PRIMARY KEY (ID);
A _____ ___ is a key used to link two tables together.
foreign key
A foriegn key is sometimes called a _______ ___
referencing key