Lab #2 SQL Worksheet – DB structure, tables, and basic SQL commands

This lab covers an introduction to SQL commands to create tables. Basic data retrieval commands are also covered, as well as basic data manipulation commands to insert, update and delete data from a table.

PLEASE READ:

  1. Respect the file format specified in the first lab
  2. Please screenshot the process involved in opening and logging in to your db and user that you installed in lab 1 to start writing commands.
  3. Take a screenshot of the command and the result. Make sure they are not separate screenshots.
  4. In your file, copy the question from your lab followed by the screenshot of your query. Make sure that your lastnamef appears in the screenshot. This part is important.
  5. You may ask questions related to understanding the prompt.

Introduction

SQL (Structured Query Language) is the query language for relational database systems. SQL includes commands to

(i) define/alter (change) the structure of a database and its components, and (ii) manipulate and query a database ...

Although SQL is an ANSI (American National Standards Institute) standard, there are some slightly different versions/implementations of SQL. However, to be compliant with the ANSI standard, they all support at least the major commands (such as INSERT, UPDATE, DELETE, SELECT ...) in a similar manner.

In relational database systems, data is contained in tables. A table is a collection of rows (tuples) of the same structure. Tuples look like this: (x, y, z, etc) by the way, and can vary in length. A table consists of columns (attributes). Below is an example of a table called Vendor which contains three rows (one for each vendor) and seven columns:

Table Vendor