Section 1

Preview this deck

WHERE

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (18)

Section 1

(18 cards)

WHERE

Front

Comparison operators used with the WHERE clause are: = equal to != not equal to > greater than < less than >= greater than or equal to <= less than or equal to

Back

Relational Database

Front

A relational database is a database that organizes information into one or more tables.

Back

Select

Front

SELECT is a clause that indicates that the statement is a query. You will use SELECT every time you query data from a database.

Back

LIMIT

Front

LIMIT is a clause that lets you specify the maximum number of rows the result set will have. This saves space on our screen and makes our queries run faster.

Back

Like _

Front

LIKE is a special operator used with the WHERE clause to search for a specific pattern in a column. The _ means you can substitute any individual character here without breaking the pattern.

Back

Lesson 4 Review

Front

JOIN will combine rows from different tables if the join condition is true. LEFT JOIN will return every row in the left table, and if the join condition is not met, NULL values are used to fill in the columns from the right table. Primary key is a column that serves a unique identifier for the rows in the table. Foreign key is a column that contains the primary key to another table. CROSS JOIN lets us combine all rows of one table with all rows of another table UNION stacks one dataset on top of another. WITH allows us to define a bunch of temporary tables that can be used in the final query.

Back

Review

Front

SQL is a programming language designed to manipulate and manage data stored in relational databases. A relational database is a database that organizes information into one or more tables. A table is a collection of data organized into rows and columns. A statement is a string of characters that the database recognizes as a valid command. CREATE TABLE creates a new table. INSERT INTO adds a new row to a table. SELECT queries data from a table. UPDATE edits a row in a table. ALTER TABLE changes an existing table. DELETE FROM deletes rows from a table.

Back

Constraints

Front

Constraints that add information about how a column can be used are invoked after specifying the data type for a column. They can be used to tell the database to reject inserted data that does not adhere to a certain restriction. 1. PRIMARY KEY columns can be used to uniquely identify the row. Attempts to insert a row with an identical value to a row already in the table will result in a constraint violation which will not allow you to insert the new row. 2. UNIQUE columns have a different value for every row. This is similar to PRIMARY KEY except a table can have many different UNIQUE columns. 3. NOT NULL columns must have a value. Attempts to insert a row without a value for a NOT NULL column will result in a constraint violation and the new row will not be inserted. 4. DEFAULT columns take an additional argument that will be the assumed value for an inserted row if the new row does not specify a value for that column.

Back

SQL

Front

Structured Query Language, is a programming language designed to manage data stored in relational databases. SQL operates through simple, declarative statements. This keeps data accurate and secure, and helps maintain the integrity of databases, regardless of size.

Back

ALTER TABLE

Front

ALTER TABLE is a clause that lets you make the specified changes.

Back

Common Data Types

Front

All data stored in a relational database is of a certain data type. Some of the most common data types are: Integer, a positive or negative whole number Text, a text string Date, the date formatted as YYYY-MM-DD for the year, month, and day Real, a decimal value

Back

Table

Front

A table is a collection of data organized into rows and columns. Tables are sometimes referred to as relations.

Back

Column

Front

A column is a set of data values of a particular type.

Back

AS

Front

AS is a keyword in SQL that allows you to rename a column or table using an alias. The new name can be anything you want as long as you put it inside of single quotes. Here we renamed the name column as Movies.

Back

Row

Front

A row is a single record in a table

Back

Aggregates Review

Front

COUNT: count the number of rows SUM: the sum of the values in a column MAX/MIN: the largest/smallest value AVG: the average of the values in a column ROUND: round the values in the column GROUP BY is a clause used with aggregate functions to combine data from one or more columns. HAVING limit the results of a query based on an aggregate property.

Back

Review

Front

SELECT is the clause we use every time we want to query information from a database. AS renames a column or table. DISTINCT return unique values. WHERE is a popular command that lets you filter the results of the query based on conditions that you specify. LIKE and BETWEEN are special operators. AND and OR combines multiple conditions. ORDER BY sorts the result. LIMIT specifies the maximum number of rows that the query will return. CASE creates different outputs.

Back

*

Front

* is a special wildcard character. It allows you to select every column in a table without having to name each one individually

Back