MySQL Basics Flashcards
Database
A repository designed for organizing and accessing information
Database Management System (DBMS)
Software designed to store, manipulate, and retrieve data in a database
Database Manipulation Language (DML)
Used to store and retrieve data from the database
Database Control Language (DCL)
Used to restrict access to data by certain users
Relational Model
Database contains a set of tables
Character String types
char(n) - always of num size
varchar(n) - no padding
Numeric types
- integer, smallint, bigint
- numeric(p,s) for signed fixed-point numbers with p digits and s decimal places
- decimal(p,s)
- real
- double precision
- float(p)
Temporal types
Datetimes and Intervals
Datetime subtypes
- Date YYYY-MM-DD
- Time HH:MM:SS
- Timestamp YYYY-MM-DD HH:MM:SS
Interval subtypes
Year-Month Interval
- ‘3-1’ Year to Month
Day-Time Interval
- ‘5 10:30:22.5’ Day to Second
Binary types
- Bit(L)
- BitVarying(L)
- BLOB(L)
Boolean Values
True, false, unknown
Primary Key (PK)
Values that uniquely identify a row
- The value of a PK for every row is unique
- No PK can be NULL
Foreign Key (FK)
Column(s) that refers to some other column(s) in some table
Types of table relations
Many-to-many, one-to-one, one-to-many