Differences
This shows you the differences between two versions of the page.
linux_wiki:create_a_simple_database_schema [2016/09/11 00:05] billdozor created |
linux_wiki:create_a_simple_database_schema [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Create A Simple Database Schema ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Creating a simple database in MariaDB. | ||
- | |||
- | ---- | ||
- | |||
- | ====== Basic Database Commands ====== | ||
- | |||
- | Connect to the database | ||
- | <code bash> | ||
- | mysql -u root -p | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show databases available | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Open a database | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Display tables in the database | ||
- | <code bash> | ||
- | MariaDB [(mysql)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Display all (SELECT *) contents of the table ' | ||
- | <code bash> | ||
- | MariaDB [(mysql)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show details of the table ' | ||
- | <code bash> | ||
- | MariaDB [(mysql)]> | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Create a Database ====== | ||
- | |||
- | \\ | ||
- | Create a database called ' | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Open the new database | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Create a new table in the emails database | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | * When you create a table, you must define the names of the columns and the type of data they should contain | ||
- | * userID INT -> Named userID and of type integer | ||
- | * userFirstName char(25) -> Named userFirstName and of type characters up to 25 long | ||
- | |||
- | \\ | ||
- | Show the tables in the emails DB, display contents of the users table, show the data types in the users table. | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | MariaDB [emails]> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | ---- | ||