Database Systems: The Complete Book- P4
Thông tin tài liệu:
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ìm kiếm theo từ khóa liên quan:
Oracle cơ bản giáo trình cơ sở dữ liệu bảo mật cơ sở dữ liệu cơ sở dữ liệu Mysql giáo trình sqlGợi ý tài liệu liên quan:
-
62 trang 402 3 0
-
Giáo trình Cơ sở dữ liệu: Phần 2 - TS. Nguyễn Hoàng Sơn
158 trang 294 0 0 -
Giáo trình Cơ sở dữ liệu: Phần 2 - Đại học Kinh tế TP. HCM
115 trang 176 0 0 -
Giáo trình Cơ sở dữ liệu: Phần 1 - Sở Bưu chính Viễn Thông TP Hà Nội
48 trang 171 1 0 -
Giáo Trình về Cơ Sở Dữ Liệu - Phan Tấn Quốc
114 trang 119 1 0 -
Giáo trình cơ sở dữ liệu quan hệ_3
26 trang 106 0 0 -
Giáo trình Cơ sở dữ liệu (Ngành: Công nghệ thông tin - Trung cấp) - Trường Cao đẳng Xây dựng số 1
49 trang 100 0 0 -
54 trang 70 0 0
-
134 trang 62 1 0
-
0 trang 57 0 0
-
Bài giảng cơ sở dữ liệu - chương 1 - ĐH KHTN Tp.HCM
46 trang 48 0 0 -
Giáo trình Cơ sở dữ liệu: Phần 1 - ĐH công nghiệp Tp.HCM
41 trang 42 0 0 -
57 trang 40 1 0
-
Giáo trình Cơ sở dữ liệu - Phần 2: SQL Server - ĐH Công nghiệp Tp.HCM
147 trang 39 2 0 -
Giáo trình Cơ sở dữ liệu: Phần 2 - Cao Thị Nhạn, Nguyễn Thị Thanh Bình
55 trang 36 0 0 -
Asp.Net 3.5 In Simple Steps- P6
10 trang 35 0 0 -
Asp.Net 3.5 In Simple Steps- P4
10 trang 35 0 0 -
Thực hành cơ sở dữ liệu: Phần 2
92 trang 34 0 0 -
THỰC HÀNH LAB : PHƯƠNG PHÁP TẤN CÔNG CỦA HACKER VÀO CÁC ỨNG DỤNG WEB BỊ LỖI SQL INJECTION
124 trang 34 1 0 -
Asp.Net 3.5 In Simple Steps- P5
10 trang 33 0 0