11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SQL 455Structured Query Language (SQL) is a st<strong>and</strong>ardized way to query <strong>and</strong> manipulate databases. Here the statement SELECT NUMBER, NAME,PRICE WHERE PRICE >= 50.00 extracts only the records meeting that criterion.franca for relational database systems (see database managementsystem).A relational database (such as Oracle, Sybase, IBM DB2,<strong>and</strong> Micros<strong>of</strong>t Access) stores data in tables called relations.The columns in the table describe the characteristics <strong>of</strong>an entity (corresponding to data fields). For example, in acustomer database the Customer table might include attributessuch as customer number, First_name, Last_Name,Street, City, Phone_number, <strong>and</strong> so on. The rows in thetable (sometimes called tuples) represent the data recordsfor the various customers.Many database systems have more than one table. Forexample, a store’s database might contain a Customers table(for information identifying a customer), an Item table (givingcharacteristics <strong>of</strong> an item, such as price <strong>and</strong> number instock), <strong>and</strong> a Transaction table (whose characteristics mightbe customer number, date, item bought, <strong>and</strong> so on). Noticethat the Transaction record contains both a customer number<strong>and</strong> an item number. It thus serves as a sort <strong>of</strong> bridge orlink between the Customer <strong>and</strong> Item tables.SQL provides comm<strong>and</strong>s that can be used to specify <strong>and</strong>access components <strong>of</strong> a database. For example, the INSERT<strong>and</strong> DELETE comm<strong>and</strong>s can be used to add or remove rows(records) from tables.To query a database means to give criteria for selectingcertain records from a table. For example, the querySELECT * FROM CUSTOMERS WHERE LAST_NAME =“Howard”would return the complete records for all customers whoselast name is Howard. If only selected fields are desired, theycan be specified like this:SELECT NUMBER, NAME, PRICE FROM ITEMS WHEREPRICE > = 50.00This query will display the Number, Name, <strong>and</strong> Price fieldsfor all items whose price is greater than or equal to $50.00.SQL includes many comm<strong>and</strong>s to further refine dataprocessing <strong>and</strong> reporting. There are built-in mathematicalfunctions as well as a GROUP BY comm<strong>and</strong> for furtherbreaking down a report by a particular field name orvalue.SQL can be used interactively by typing comm<strong>and</strong>s ata prompt, but database applications designed for less technicalusers <strong>of</strong>ten provide a user-friendly query form (<strong>and</strong>perhaps menus or buttons). After the user selects the appropriatefields <strong>and</strong> values, the program will then generate thenecessary SQL statements <strong>and</strong> send them to the internal“database engine” for processing. The results will then bedisplayed for the user.SQL procedures can be stored <strong>and</strong> managed as part <strong>of</strong>a database. SQL can also be “embedded” within a morecomplete programming language environment so that, forexample, a Java program can perform SQL operations whileusing Java for processing that cannot be specified in SQL.In the mid-1990s an object-oriented version <strong>of</strong> SQL calledOQL (object query language), allowing the use <strong>of</strong> that popularparadigm for database operations (see object-orientedprogramming).One <strong>of</strong> the most popular implementations <strong>of</strong> SQL isMySQL, which is privately owned <strong>and</strong> developed but availablefor free license on many platforms, including Windows<strong>and</strong> Linux. A number <strong>of</strong> applications are designed to workwith MySQL databases: see, for example, wikis <strong>and</strong> Wikipedia<strong>and</strong> YouTube.Further ReadingForta, Ben. Sams Teach Yourself SQL in 10 Minutes. 3rd ed. Indianapolis:Sams, 2004.K<strong>of</strong>ler, Michael. The Definitive Guide to MySQL 5. 3rd ed. Berkeley,Calif.: Apress, 2005.MySQL home page. Available online. URL: http://mysql.org/.Accessed August 22, 2007.Rankins, Ray, et al. Micros<strong>of</strong>t SQL Server 2005 Unleashed. Indianapolis:Sams, 2006.Tahaghoghi, Seyed M. M., <strong>and</strong> Hugh Williams. Learning MySQL.Sebastapol, Calif.: O’Reilly Media, 2006.Taylor, Allen G. SQL for Dummies. 6th ed. Hoboken, N.J.: Wiley,2006.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!