5 - SQL_CONT

5 - SQL_CONT - Review Some Examples Application Programming...

Info iconThis preview shows pages 1–20. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Review Some Examples Application Programming Embedded SQL, Dynamic SQL ODBC JDBC An Instance of Sailors An Instance of Boats An Instance of Reserves 1. Construct the cross-product of tables in the from-list 2. The second step is to apply the qualification in the WHERE clause, S.age >= 18. 3. The third step is to eliminate unwanted columns. Only columns mentioned in the SELECT clause, the GROUP BY clause, or the HAVING clause are necessary, which means we can eliminate sid and sname in our example. 4. The fourth step is to sort the table according to the GROUP BY clause to identify the groups 5 . The fifth step is to apply the group-qualification in the HAVING clause, that is, the condition COUNT (*) > 1. This step eliminates the groups with rating equal to 1, 9, and 10. !! Order in which the WHERE and GROUP BY clauses are considered is significant Role of an application: Update databases, extract info, through: User interfaces Non-interactive programs Development tools (Access, Oracle): For user Interfaces Programming languages (C, C++, Java, ): User Interfaces Non-Interactive programs The frst technique For sending SQL statements to the DBMS is embedded SQL The SQL standard defnes embeddings oF SQL in a variety oF programming languages such as Pascal, PL/I, ortran, C, and Cobol. A language to which SQL queries are embedded is reFerred to as a host language, and the SQL structures permitted in the host language comprise embedded SQL. The basic Form oF these languages Follows that oF the System R embedding oF SQL into PL/I. Advantages: ??? Disadvantages: Not portable between database systems Difficult debugging This is a central idea of embedded SQL: Placing SQL statements in a program written in a host programming language. BrieFy, the following techniques are used to embed SQL statements in a host language Embedded SQL statements are processed by a special SQL precompiler. All SQL statements begin with an introducer and end with a terminator, both of which Fag the SQL statement for the precompiler. Variables from the application program, called host variables, can be used in embedded SQL statements wherever constants are allowed The embedded SQL shown in previous example is known as static SQL. It is called static SQL because the SQL statements in the program are static; that is, they do not change each time the program is run. As described in the previous section, these statements are compiled when the rest of the program is compiled. Static SQL works well in many situations and can be used in any application for which the data access can be determined at program design time....
View Full Document

Page1 / 68

5 - SQL_CONT - Review Some Examples Application Programming...

This preview shows document pages 1 - 20. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online