0501 | Introduction to SQL and Databases
Disclaimer | Attribution
This short "SQL 101" is based on my own notes taken during the Google Cybersecurity video course by Google.
Databases
- using databases allow us to store large amounts of data while keeping it quick and easy to access
Database
- an organized collection of information or data
- can be accessed by multiple people simultaneously
- can store massive amounts of data
- perform complex tasks while accessing data
Spreadsheets
- often designed for a single user or a small team to store less data
Relational database
- a structured database containing tables that are related to each other
- each table contains fields of information
- these are the columns of the tables
- example
-----------------
employees (table)
-----------------
employee_id (field)
device_id (field)
username (field)
department (field)
office (field)
----------------- - rows are called records
- rows are filled with specific data related to the columns in the table
- often multiple tables
- connecting two tables is possible | if they share a common column | they are called keys
Primary key
- a column where every row has a unique entry
- must not have any duplicate values, or any null or empty values
- allows for unique identification of the rows in the table
- a table can have only one primary key
Foreign key
- a column in a table that is a primary key in another table
- can have empty values and duplicates
- allows for two tables to connect together
- a table can have multiple foreing keys
Query databases with SQL
SQL | Structured Query Language
- a programming language used to create, interact with, and request information from a database
Query
- a request for data from a database table or a combination of tables
Log
- a record of events that occur within an organization's systems
Accessing SQL from Linux
- from the linux cli |
sqlite3