My First Database

Overview

Prerequisites

Create MySQL Connection

Install MySQL Driver

Create Database

CREATE DATABASE IF NOT EXISTS databaseName;

Create Table

CREATE TABLE IF NOT EXISTS databaseName.tableName(
	id INT AUTO_INCREMENT PRIMARY KEY,
	name TEXT NOT NULL,
	name_abbreviation VARCHAR(3));

Insert Records

INSERT INTO databaseName.tableName(id, name, name_abbreviation) VALUES
    (1, "Leon", "LEO");

INSERT INTO databaseName.tableName(id, name, name_abbreviation) VALUES
    (2, "Christopher", "CRS");

INSERT INTO databaseName.tableName(id, name, name_abbreviation) VALUES
    (3, "Hunter", "HNT");

Select All Records

SELECT * FROM databaseName.tableName

Select All Records Where

SELECT * FROM databaseName.tableName WHERE id > 1