Module 8: Introduction to SQL

SQL Overview

Basic SQL Syntax

Keywords are not case sensitive, however it's common practice to write them in all caps. Some software is case sensitive when handling column/table names.

A simple select query

SELECT * FROM menu;
Contents of the menu table
Selecting only one row

Querying MySQL flag

Querying Oracle flag

Querying PostgreSQL flag

Querying SQL Server flag

Manual Database Enumeration

There are differences between different database software. Understand their basic syntaxes.

Enumerating MySQL Databases

MySQL Specific Functions and Tables

Getting the version of a MySQL database

Getting the user connected to a MySQL database

Getting a list of databases or schemas

Getting a list of tables in a database or schema

Getting a list of columns and their data type in a table in MySQL

Enumerating Microsoft SQL Server Databases

Microsoft SQL Server Specific Functions and Tables

Selecting the version of MS SQL Server

Selecting the current user connected to MS SQL Server

Listing databases in MS SQL Server

Listing tables in MS SQL Server

Getting a list of columns and their data type in a table in SQL Server

Enumerating PostgreSQL Databases

PostgreSQL Specific Functions and Tables

Selecting the version of a PostgreSQL database

Selecting the current user connected to a PostgreSQL database

Listing databases in a PostgreSQL database

Listing tables in a PostgreSQL database

Getting a list of columns and their data type in a table in a PostgreSQL database

Enumerating Oracle Databases

Oracle Specific Tables

Selecting the version of an Oracle database

Selecting the current user connected to an Oracle database

Listing all users or schemas

Listing tables in a schema

Getting a list of columns and their data type in a table in an Oracle database

Last updated