Danh mục

Database Systems: The Complete Book- P4

Số trang: 50      Loại file: pdf      Dung lượng: 5.14 MB      Lượt xem: 12      Lượt tải: 0    
Thư viện của tui

Phí tải xuống: 10,000 VND Tải xuống file đầy đủ (50 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Database Systems: The Complete Book- P4: Database Systems and Database Design and Application courses offered at the junior, senior and graduate levels in Computer Science departments. Written by well-known computer scientists, this introduction to database systems offers a comprehensive approach, focusing on database design, database use, and implementation of database applications and database management systems
Nội dung trích xuất từ tài liệu:
Database Systems: The Complete Book- P4 276 CH.4PTER 6. THE DATABASE LANGUAGE SQL 6.4. FULL-RELATION OPERATIONS StarsIn(movieTitle, movieyear, starname) 6.4 Full-Relation Operations biovieStar(name, address, gender, birthdate) ~ovieExec(name, address, cert#, networth) In this section we shall study some operations that act on relations as a whole, Studio(name, address, presC#) rather than on tuples individually or in small numbers (as do joins of several relations, for instance). First, we deal with the fact that SQL uses relations that describe the tuples that would appear in the following SQL expressions: are bags rather than sets, and a tuple can appear more than once in a relation. We shall see how to force the result of an operation to be a set in Sectiori 6.4.1, a) Studio CROSS JOIN MovieExec; and in Section 6.4.2 we shall see that it is also possible to prevent the elimination b) StarsIn NATURAL FULL OUTER JOIN MovieStar; of duplicates in circumstances where SQL systems ~ould normally eliminate them. c) StarsIn FULL OUTER JOIN MovieStar ON name = starName; Then, we discuss how SQL supports the grouping and aggregation operator y that we introduced in Section 5 4.4. SQL has aggregation operators and *! Exercise 6.3.8 : Using the database schema a GROUP-BY clause. There is also a HAVING clause that allows selection of Product (maker, model, type) certain groups in a way that depends on the group as a whole, rather than on PC(mode1, speed, ram, hd, rd, price) individual tuples. Laptop(mode1, speed, ram, hd, screen, price) Printer(mode1, color, type, price) 6 4 1 Eliminating Duplicates .. write an SQL query that will produce information about all products - PC. AS mentioned in Section 6.3.4, SQLs notion of relations differs from the abstract laptops, and printers - including their manufacturer if available, and whatever notion of relations presented in Chapter 3. A relation, being a set, cannot have information about that product is relevant (i.e.. found in the relation for that more than one copy of any given tuple. When an SQL query creates a new type of product). relation, the SQL system does not ordinarily eliminate duplicates. Thus. the SQL response to a query may list the same tuple several times. Exercise 6.3.9 : Using the two relations Recall from Section 6.2.1 that one of several equivalent definitions of the Classes(class, type, country, numGuns, bore, displacement) meaning of an SQL select-from-where query is that we begin lvith the Carte- v Ships(name, class, launched) sian product of the relations referred to in the FROM clause. Each tuple of the product is tested by the condition in the WHERE clause. and the ones that pass from our database schema of Exercise 5.2.4, mite an SQL query that will pro- tb the test are given t,he output for projection according to the SELECT clause. ...

Tài liệu được xem nhiều:

Gợi ý tài liệu liên quan: