ESCEI-ESHS Mentorship
DIR-657
Link-Local............................................ : f380::h590::fb69::3680::d53b%6
IPv4.................................................. : 192.168.56.1
​
​
-- Database-Level (Database IPO iPv6 //(insert ESUSD Static IP)
​
DROP DATABASE databaseName
DROP DATABASE IF EXISTS databaseName -- Delete if it exists
CREATE DATABASE databaseName -- Create a new database
CREATE DATABASE IF NOT EXISTS databaseName -- Create only if it does not exists
SHOW DATABASES -- Show all the databases in this server
USE databaseName -- Set the default (current) database
SELECT DATABASE() -- Show the default database
SHOW CREATE DATABASE databaseName
​
mysql> CREATE DATABASE ESCEICompetition_User;
Query OK, 1 row affected (0.03 sec)
mysql> DROP DATABASE ESCEICompetition_User;
Query OK, 0 rows affected (0.11 sec)
mysql> CREATE DATABASE IF NOT EXISTS ESCEICompetition_User;
Query OK, 1 row affected (0.01 sec)
mysql> DROP DATABASE IF EXISTS ESCEICompetition_User;
Query OK, 0 rows affected (0.00 sec)
​
--Database :ESCEICompetition_User
​
--Root Mysql Client Accounts:
"root" Shrenil Sharma
"" Hayden Crabbs
"root" Anthony Choi
"root" Justin Garza
​
--Last Mysql Snapshot 06/22/17 "11:16 AM" by user:// "root" Shrenil Sharma
WARNING: Snapshots can only by produced by root users on the Mysql Client protocol
​
-- Remove the database "EXISTS ESCEICompetition_User", if it exists.
-- Beware that DROP (and DELETE) actions are irreversible and not recoverable!
mysql> DROP DATABASE IF EXISTS EXISTS ESCEICompetition_User;
Query OK, 1 rows affected (0.31 sec) -- Create the database "EXISTS ESCEICompetition_User"
mysql> CREATE DATABASE EXISTS ESCEICompetition_User;
Query OK, 1 row affected (0.01 sec) -- Show all the databases in the server -- to confirm that "EXISTS ESCEICompetition_User" database has been created.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| EXISTS ESCEICompetition_User |
| ...... |
-- Set "EXISTS ESCEICompetition_User" as the default database so as to reference its table directly.
mysql> USE ESCEICompetition_User;
Database changed -- Show the current (default) database
mysql> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| EXISTS ESCEICompetition_User |
+------------+
-- Show all the tables in the current database.
-- "ESCEICompetition_User" has no table (empty set).
mysql> SHOW TABLES;
Empty set (0.00 sec)
-- Create the table "products". Read "explanations" below for the column defintions
mysql> CREATE TABLE IF NOT EXISTS products (
UserID INT UNSIGNED NOT NULL AUTO_INCREMENT,
UserCode CHAR(3) NOT NULL DEFAULT '',
name VARCHAR(30) NOT NULL DEFAULT '',
TeamSize INT UNSIGNED NOT NULL DEFAULT 0,
FeesPaid DECIMAL(7,2) NOT NULL DEFAULT 99999.99,
PRIMARY KEY (UserID)
);
Query OK, 0 rows affected (0.08 sec)
-- Show all the tables to confirm that the "products" table has been created
mysql> SHOW TABLES;
+---------------------+
| Tables_in_ESCEICompetition_User |
+---------------------+
| products |
+---------------------+
-- Describe the fields (columns) of the "products" table
mysql> DESCRIBE products;
+-------------+------------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+------------+----------------+
| UserID | int(10) unsigned | NO | PRI | NULL | auto_increment |
| UserCode | char(3) | NO | | | |
| name | varchar(30) | NO | | | |
| TeamSize | int(10) unsigned | NO | | 0 | |
| FeesPaid | decimal(7,2) | NO | | 99999.99 | |
+-------------+------------------+------+-----+------------+----------------+
-- Show the complete CREATE TABLE statement used by MySQL to create this table
mysql> SHOW CREATE TABLE products \G
*************************** 1. row ***************************
Table: products
Create Table:
CREATE TABLE `products` (
`UserID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserCode` char(3) NOT NULL DEFAULT '',
`name` varchar(30) NOT NULL DEFAULT '',
`TeamSize` int(10) unsigned NOT NULL DEFAULT '0',
`FeesPaid` decimal(7,2) NOT NULL DEFAULT '99999.99',
PRIMARY KEY (`productID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1