Foundations Flashcards
(100 cards)
What is SQL?
a programming language designed to manage data stored in relational databases
What is a relational database?
a type of database that stores and provides access to data points that are related to one another
What is a table?
a collection of data organized into rows and columns
What is a column?
a set of data values of a particular type
What is a row?
a single record in a table
What are common data types?
integer, text, date, real
What is an integer data type?
a positive or negative whole number
What is a text data type?
a text string
What is a date data type?
the date formatted as YYYY-MM-DD
What is a real data type?
a decimal value
What is a statement?
text that the database recognizes as a valid command, always ends in a semicolon (;)
What does CREATE TABLE do?
a clause also known as a command; performs specific tasks in SQL. conventionally written in capital letters.
What is the point of the tablename in a statement?
refers to the name of the table that the command is applied to
What is a parameter?
a list of columns, data types, or values that are passed to a clause as an argument
How do we write statements?
they can be written all on one line, or split up across multiple lines if it makes it easier to read
What does CREATE do?
allows us to create a new table in the database
What is an example of creating a table?
CREATE TABLE celebs (
id INTEGER,
name TEXT,
age INTEGER,
);
What does INSERT do?
it inserts a new row into a table
When do we use INSERT?
when we want to add new records
What is an example of an INSERT?
INSERT INTO celebs (id, name, age)
VALUES (1, ‘Justin Beiber’, 29);
What does INSERT INTO do?
a clause that adds the specified row or rows
What does SELECT do?
used to fetch data from a database
What does SELECT return?
a new table called the result set
What is an example of a SELECT statement?
SELECT name FROM celebs;