Database / SQL Flashcards
Database
organized info so it can be accessed, managed and updated.
od amu
Relational DB
Type of DB where tables are related / linked by common data.
Tables
contain rows and cols. rows aka records. cols aka attributes.
Relational DB management system
a program that allows you to manage a relational database .
e.g. such as create and update info.
SQL
Structured Query Language
program language that allows user to communicate w/DBs. It allows to request data, or perform actions on data.
Why SQL
DTE
data + table + ebed
data = (MADD) allows users to access, describe, define, manipulate data
table = C(v)SD
C = tv
S= tv
allows users to create tables and views. drop tables. set permissions on tables and view and create stored procedures and fxs
Draw SQL Architecture
SQL query
query language processor < parser + optimization
DBMS engine < flies manager + transaction manager
Physical DB
What is a primary key
conditions:
a field uniquely identifies each record in a table.
- only 1 unique primary key for table
- each must contain unique values
- no null values
What is foreign key
links 2 tables together. aka referencing key.
the relationship (link) is the primary key matching the foreign key.
is a column
creating primary key
steps to create
-usually created while creating the table, but can be created after creation of table.
- create table
- create primary table
1.
a. write command “create table”
b. name table “x”
c.
sql statements
= used to perform tasks such as update and retrieve data.
d^3 (dmcc) L^4
table cad
data siud
permissions gr
db transactions src
SELECT Query
what are ways to select data
=allows you to select and get data from table.
results are returned in tables called result-sets.
-fetch ALL fields
SELECT * FROM table_name
SELECT column1, column2, FROM table_name;
eg: SELECT ID, NAME FROM CUSTOMERS
INSERT Query
how
= adds new rows of data to table
INSERT INTO table_name (column1, column2)
VALUES
What is SQL WHERE
used to specify a condition when fetching data.
WHERE [condition]
What are JOINS
Different types?
is a condition allows combine records from 2 or more tables.
Types = 4
Full, inner, left and rt