MySQL Basics Flashcards
(35 cards)
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
Schema
Collection of tables and other data description objects
Select
Gets information from the table
Select *
Gets every row from a table that meets the condition
Multi-line comments
/* */
Single-line comments
–
What does Select generate
A result table
Where clause
Used to specify a condition each row must satisfy to be in the query result
Operators
Traditional: =, <, >, <=, >=
- [not] Between
- Is [not] NULL
- [not] Like
- [not] In
- Not
Like Regex
% - Matches any substring with 0+ characters
_ - Matches any single character