Differences
This shows you the differences between two versions of the page.
linux_wiki:perform_simple_sql_queries_against_a_database [2018/05/20 23:08] billdozor [Basics of SQL: Add,Remove,Modify] |
linux_wiki:perform_simple_sql_queries_against_a_database [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Perform Simple SQL Queries Against A Database ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Basic SQL commands. | ||
- | |||
- | ---- | ||
- | |||
- | ====== Lab Setup ====== | ||
- | |||
- | The following virtual machines will be used: | ||
- | * server2.example.com (192.168.1.151) -> Database here | ||
- | |||
- | **Previous Sections Completed** | ||
- | * [[linux_wiki: | ||
- | * [[linux_wiki: | ||
- | |||
- | ---- | ||
- | |||
- | ====== Basics of SQL: Connect and Navigate ====== | ||
- | |||
- | Connect to the database | ||
- | <code bash> | ||
- | mysql -u root -p | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show databases on the system | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Use a specific database called ' | ||
- | <code bash> | ||
- | MariaDB [(none)]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show the tables in the database, emails | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show the fields available in a table called ' | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | ====== Basics of SQL: Add, | ||
- | |||
- | \\ | ||
- | Insert two new rows/ | ||
- | <code bash> | ||
- | # Values method | ||
- | MariaDB [emails]> | ||
- | |||
- | # Set method | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show all entries from the users table | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Show all entries from the users table where the last name equals " | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Delete the entry where the user id is 2 | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | \\ | ||
- | Update the entry of Robert Jones to change the email address | ||
- | <code bash> | ||
- | MariaDB [emails]> | ||
- | </ | ||
- | |||
- | ---- | ||