03 - MySQL Flashcards

1
Q

What is SQL?

A

Structured Query Language. It is a comprehensive database language. Standard for relational databases.

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

What is MySQL?

A

RDBMS. Created by MySQL AB and bought out by Sun Microsystems (Oracle). MySQL supports: Web applications, Open-Source, low overhead, large size table.

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

SQL: Login to mysql?

A

$ mysql -u root -p

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

SQL: List all current databases?

A

$ SHOW DATABASES;

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

SQL: Create database?

A

$ CREATE DATABASE [db_name];

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

SQL: Delete database?

A

$ DROP DATABASE [db_name];

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

SQL: Make database active?

A

$ USE [db_name];

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

SQL: Show tables in the current database?

A

$ SHOW TABLES;

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

SQL: Create table with three fields called Officers?

A

$ CREATE TABLE Officers (BadgeNo int, Name varchar(40), Rank varchar(10));

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

SQL: Insert entry into table?

A

$ INSERT INTO Officers VALUES (132, “Ann G”, “Dep”);

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

SQL: How to remove a table?

A

$ DROP TABLE [tbl_name];

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

Name Numeric Data Types?

A
  • int - is used for integer (whole) numbers
  • float - is used for floating point (decimal) numbers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Name Time Related Data Types?

A
  • date
  • time
  • datetime

Date format: “yyyy-mm-dd”

Time format: “hh:mm:ss”

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

Name String Data Types?

A
  • Char - fixed size (3 Bytes)
  • Varchar - variable size
  • text

Char and varchar are good up to 255 characters. If you wish to store more text than this you should use the text data type. This takes no arguments and gives a much larger storage capacity.

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

SQL: How to insert values from a CSV file?

A

LOAD DATA LOCAL INFILE ‘C:/Officers.csv’ INTO TABLE Officers FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”’;

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