Introduction to MySQL /MariaDB and SQL Basics Read …
[Pages:51]Introduction to MySQL /MariaDB and SQL Basics
Read Chapter 3!
MySQL / MariaDB
CS445
09/16/19
Pacific University
1
College Database E-R Diagram
CS445
09/16/19
Pacific University
2
Database tasks
start MariaDB
? setup user passwords
shutdown MariaDB create database create table
? primary key ? index ? foreign key
insert data
? source a file
delete data
? drop
query data
? where ? join ? group ? order ? subquery
*Coding standards on the class web page!
CS445
09/16/19
Pacific University
3
MariaDB
ssh to db.cs.pacificu.edu (64.59.233.245) ssh -X db.cs.pacificu.edu
[you@db ~]# $ mysql -u PUNetID -p mysql> set password = PASSWORD('NEWPASSWORD'); mysql> show databases;
mysql> use PUNetID_test;
CS445
09/16/19
Pacific University
4
Data types
TINYINT/SMALLINT/INT/BIGINT SIGNED/UNSIGNED
BIT
FLOAT/DOUBLE
BOOLEAN
CHAR / BINARY
VARCHAR(###)
/
VARBINARY(###)
DATE / TIME / DATETIME / TIMESTAMP
[TINY|MEDIUM|LONG]TEXT
[TINY|MEDIUM|LONG]BLOB
ENUM
SET 09/16/19
CS445 Pacific University
5
M
"M indicates the maximum display width for integer types. The maximum display width is 255. Display width is unrelated to the range of values a type can contain, ... .
For floating-point and fixed-point types, M is the total number of digits that can be stored."
CS445
09/16/19
Pacific University
6
Strings
Character Set
? set of characters (ASCII, UTF8, ...
Collation
? the order of the characters within the set
MariaDB [will4614_test]> show variables like 'character_set_server';
+----------------------+-------+
| Variable_name
| Value |
+----------------------+-------+
| character_set_server | utf8 |
+----------------------+-------+
1 row in set (0.00 sec)
MariaDB [will4614_test]> show variables like 'collation_server';
+------------------+-----------------+
| Variable_name | Value
|
+------------------+-----------------+
| collation_server | utf8_general_ci |
+------------------+-----------------+
1 row in set (0.01 sec)
CS445
09/16/19
Pacific University
7
Create Table
CREATE TABLE People (
PersonID INT NOT NULL AUTO_INCREMENT,
FName VARCHAR(50),
LName VARCHAR(50),
Login VARCHAR(20) NOT NULL,
CONSTRAINT People_PersonID_PK PRIMARY KEY (PersonID),
CONSTRAINT People_Login_U UNIQUE (Login)
) Engine=InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin;
CS445
09/16/19
Pacific University
8
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- mariadb tutorialspoint
- creating a new function in mariadb
- mysql mariadb server security essentials
- databases through python flask and mariadb
- json support in mariadb
- a gentler introduction to mariadb database programming
- how to restore a single database from mariadb backup
- introduction to mysql mariadb and sql basics read
- practices features and best mariadb security
- creating a database