SQL Reference Guide

SQL_reference_guide

SQL_reference_guide

SQL_reference_guide

SQL_reference_guide

SQL_reference_guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 7

Scroll down to view the document on your mobile browser.
SQL_reference_guide.md 6/14/20181 / 7SQL Reference Guide BackgroundWhat is SQL? MySQL?Structured Query Language is a programming language used to query and manipulate data stored withinrelational databases.MySQL is open source software that can be placed on a server, allowing SQL commands to access the datastored there.SQL Cheat SheetThe purpose of this guide is to provide users with the SQL commands commonly used while working in theMySQL Workbench.MySQL Workbench BasicsTo execute a line or block of completed code, click the lightning bolt symbol at the top of the editor.To confirm code has been successfully run or to troubleshoot bugs, the Action Output section at thebottom of the editor provides the appropriate feedback.
SQL_reference_guide.md 6/14/20182 / 7This image demonstrates the successful creation of a new database (called animals_db in this example).Creating a DatabaseCREATE DATABASE animals_db; When the above command is entered in the MySQL Workbench editor, a new database will be created on theserver the user is connected to.Hint: A new database will only be created if it does not already exist. To delete, or drop, an existing database,first run DROP DATABASE <database_name>;, then CREATE DATABASE <database_name>;. Use carebefore deleting a database!Note the semicolon at the end of the statement. This character tells MySQL that the line of code is complete.This is an important facet of SQL syntax: forgetting the semicolon will result in errors and non-functional code.Remember to reload the connection for the new database to appear within the navigator.Creating a TableUSE animals_db;  CREATE TABLE people (   name VARCHAR(30) NOT NULL,   has_pet BOOLEAN NOT NULL,   pet_name VARCHAR(30),   pet_age INTEGER(10) ); Code Breakdown:1. USE animals_db; tells SQL the specific database we wish to access.

Navigation menu