tailieunhanh - SQL VISUAL QUICKSTART GUIDE- P9

SQL VISUAL QUICKSTART GUIDE- P9:SQL (pronounced es-kyoo-el) is the standard programming language for creating, updating, and retrieving information that is stored in databases. With SQL, you can turn your ordinary questions (“Where do our customers live?”) into statements that your database system can understand (SELECT DISTINCT city, state FROM customers;) | Chapter 2 Listing continued Listing INSERT INTO royalties VALUES T01 10000 INSERT INTO royalties VALUES T02 1000 INSERT INTO royalties VALUES T03 15000 INSERT INTO royalties VALUES T04 20000 INSERT INTO royalties VALUES T05 100000 INSERT INTO royalties VALUES T06 20000 INSERT INTO royalties VALUES T07 1000000 INSERT INTO royalties VALUES T08 0 INSERT INTO royalties VALUES T09 0 INSERT INTO royalties VALUES T10 NULL NULL INSERT INTO royalties VALUES T11 100000 INSERT INTO royalties VALUES T12 50000 INSERT INTO royalties VALUES T13 20000 Creating the Sample Database 60 3 SQL Basics You might have noticed that I barely mentioned SQL in the preceding chapter. Remember this equation SQL Relational model SQL is based on the relational model but doesn t implement it faithfully. One departure from the model is that in SQL primary keys are optional rather than mandatory. Consequently tables without keys will accept duplicate rows rendering some data inaccessible. A complete review of the many disparities is beyond the scope of this book see the Learning Database Design sidebar in Primary Keys in Chapter 2 . The upshot of these discrepancies is that DBMS users and not the DBMS itself are responsible for enforcing a relational structure. Another result is that the Model and SQL terms in Table in Chapter 2 aren t interchangeable. With that warning it s time to learn SQL. An SQL program is a sequence of SQL statements executed in order. To write a program you must know the rules that govern SQL syntax. This chapter explains how to write valid SQL statements and also covers data types and nulls. SQL Basics 61 Chapter 3 SQL Syntax SQL Syntax Figure shows an example SQL statement. Be unconcerned about the meaning semantics of the statement I m using it to explain SQL syntax. 1. Comment. A comment is optional text that explains your program. Comments usually describe what a program does and how or why code was

TỪ KHÓA LIÊN QUAN