Manipulation Flashcards
SQL
Structured Query Language
Manage data stored in relational databases
Simple, declarative statements
Keeps data accurate and secure
Helps maintain the integrity of databases
Widely used across web frameworks and database applications
Relational Database
Organizes information into one or more tables
Table
Data organized into rows and columns
Column
Set of data values of a particular type
Field (in Tableau)
Row
A single record in a table
Data Types
All data stored in a relational database is of a certain data type
Most common data types:
- INTEGER
- TEXT
- DATE
- REAL
INTEGER
A positive or negative whole number
TEXT
A text string
DATE
Date formatted as YYYY-MM-DD
Dates must be surrounded by single quotes
REAL
A decimal value
Statement
Text that the database recognizes as a valid command
Statements always end in a semicolon
Clause
Clauses perform specific tasks in SQL
By convention, clauses are written in capital letters
AKA commands
Go at the beginning of a statement
Parameter
A list of columns, data types, or values that are passed to a clause as an argument
Within the parentheses
EXAMPLE
CREATE TABLE table_name ( column_1 data_type, column_2 data_type, column_3 data_type );
CREATE TABLE is the clause
table_name is the name of the table the command is applied to
(column_1 data_type…column_3 data_type) is the parameter; the list of column names and associated data types
; marks the end of the statement
Structure of SQL Statements
The structure varies
The number of lines DOES NOT matter
A statement can be written all on one line or split up across multiple lines to make it easier to read