. Database (Web file server) structure change commands These commands allow alterations

. Database structure change commands These commands allow alterations to metadata (the data about the data). Metadata in a simple relational database comprises tables and indexes. Table metadata change commands allow creation of new tables, changes to existing tables, and destruction of existing tables, among other more obscure types of operations too obscure for this book. Table metadata commands are CREATE TABLE, ALTER TABLE, and DROP TABLE commands. Querying a Database Using SELECT The following sections examine database queries using the SELECT command in detail, as well as by example. Basic Queries The following syntax shows the structure of the SELECT statement and the FROM clause. The SELECT list is the list of fields, or otherwise, usually retrieved from tables. The FROM clause specifies one or more tables from which to retrieve data. SELECT { [alias.]field | expression | [alias.]* [,the rest of the list of fields] } FROM table [alias] [ , … ]; The easiest way to understand SQL is by example. Retrieve all fields from the AUTHOR table using the * (star or asterisk) character. The * character tells the query to retrieve all fields in all tables in the FROM clause: SELECT * FROM AUTHOR; AUTHOR_ID NAME ———- ——————————– 1 Orson Scott Card 2 James Blish 3 Isaac Azimov 4 Larry Niven 5 Jerry Pournelle 6 William Shakespeare 7 Kurt Vonnegut A semi-colon and carriage return is used to end the query command, submitting the query to the query engine. Not all relational databases execute on a semi-colon. Some databases use a different character; others just a carriage-return. Specify an individual field by retrieving only the name of the author from the AUTHOR table: SELECT NAME FROM AUTHOR; NAME ——————————– Orson Scott Card Please see the Introduction to this book for syntax conventions, known as Backus-Naur Form syntax notation. 127 Reading and Writing Data with SQL
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Leave a Reply