MySQL Basics Flashcards

(35 cards)

1
Q

Database

A

A repository designed for organizing and accessing information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Database Management System (DBMS)

A

Software designed to store, manipulate, and retrieve data in a database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Database Manipulation Language (DML)

A

Used to store and retrieve data from the database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Database Control Language (DCL)

A

Used to restrict access to data by certain users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Relational Model

A

Database contains a set of tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Character String types

A

char(n) - always of num size
varchar(n) - no padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Numeric types

A
  • 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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Temporal types

A

Datetimes and Intervals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Datetime subtypes

A
  • Date YYYY-MM-DD
  • Time HH:MM:SS
  • Timestamp YYYY-MM-DD HH:MM:SS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Interval subtypes

A

Year-Month Interval
- ‘3-1’ Year to Month
Day-Time Interval
- ‘5 10:30:22.5’ Day to Second

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Binary types

A
  • Bit(L)
  • BitVarying(L)
  • BLOB(L)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Boolean Values

A

True, false, unknown

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Primary Key (PK)

A

Values that uniquely identify a row

  • The value of a PK for every row is unique
  • No PK can be NULL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Foreign Key (FK)

A

Column(s) that refers to some other column(s) in some table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Types of table relations

A

Many-to-many, one-to-one, one-to-many

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Schema

A

Collection of tables and other data description objects

17
Q

Select

A

Gets information from the table

18
Q

Select *

A

Gets every row from a table that meets the condition

19
Q

Multi-line comments

20
Q

Single-line comments

21
Q

What does Select generate

A

A result table

22
Q

Where clause

A

Used to specify a condition each row must satisfy to be in the query result

23
Q

Operators

A

Traditional: =, <, >, <=, >=
- [not] Between
- Is [not] NULL
- [not] Like
- [not] In
- Not

24
Q

Like Regex

A

% - Matches any substring with 0+ characters
_ - Matches any single character

25
How to change Like escape character
Like '%#_%' Escape '#' allows the use of _ as a char instead of a wildcard
26
Operator precedence
Comparison operators Not And Or
27
What kind of range does Between specify
Inclusive range
28
How to rename and attribute in a Select
Select [attribute] as [name]
29
Distinct
Eliminates duplicate rows
30
Derived Attributes
Abs(n) Ceil(n) Exp(n) Floor(n) Ln(n) Mod(n,d) Power(b,e) Sqrt(n)
31
String functions
- Substring( [source] from [start] {for length} - Trim({{Leading | Trailing | Both} [to_trim] from} [source]) - Lower([source] - Upper([source]) - Position([substr] in [source])
32
Order by
Order by [ASC | DESC] [NULLS FIRST | NULLS LAST]
33
Casting
Cast([source] as [result_type])
34
Conditional Results
Case [target expression] when [candidate] then [result] else [result] END
35