Chapter 19. Simple Tasks In SQL

Table of Contents

What is SQL?
Example Tasks in SQL
Adding A New Type Of Attire
Creating A Video Download Record

What is SQL?

SQL standards for Structured Query Language and provides a command line interface to the majority of database packages available on the market today. It supposedly uses plain English language phrases but in reality is so tightly structured that you have to know the precise style and format of the requests you wish to pass to it.

Each database package provides a command line SQL interpreter which can be used to interact with the database directly. Most of the time you will not need to use it, but having some basic familiarity with it can help in solving some fairly intractible problems, so it is worth getting an idea as to how to use it.

Table 19.1. SQL Command line interpreters

DatabaseCommandTypical Usage
Oraclesqlplussqlplus wacs/password
MySQLmysqlmysql -u wacs -p

In general they will give you a prompt something like SQL> and will expect each query to be completed with a semi-colon (:) at which point they will execute what you have given them. At the end of the session, typing quit; to the SQL> prompt will usually log you out again. There are a lot of differences in the way you edit and recall existing queries, but these basic steps are the same for all major database packages.