Schaum’s Outline Series OF Principles of Computer Science phần 8

Operator = = AND OR NOT IN NHƯ Ý nghĩa bằng đến lớn hơn ít hơn lớn hơn hoặc bằng nhỏ hơn hoặc bằng không bằng không thấp hơn không lớn hơn thật nếu cả hai so sánh boolean là đúng sự thật Đúng nếu một trong hai biểu thức boolean là đúng sự thật đảo ngược giá trị thật của một nhà điều hành boolean | CHAP. 8 DATABASE 151 Table 8-1 Operator Meaning equal to greater than less than greater than or equal to less than or equal to not equal to not less than not greater than AND True if both boolean comparisons are true OR True if either boolean expression are true NOT Reverses the truth value of another boolean operator IN True if the operand is one of the listed values or one of the values returned by a subquery LIKE True if the operand matches a pattern matches anything _ underscore matches any one character Other characters match themselves BETWEEN True if the operand is within the range specified EXISTS True if a subquery returns any rows ALL True if all of a set of comparisons are true ANY True if any one of a set of comparisons is true SOME True if some of a set of comparisons is ture This will report the CS majors in alphabetical order by name. To sort in reverse alphabetical order add the word DESC descending at the end of the query. What would this query report SELECT Major FROM Student It would return one line for each student and each line would contain a major field of study. If 300 students major in computer science there will be 300 lines containing the words Computer Science . Such a report is probably not what one had in mind. Probably one is interested in a list of the different major fields of study of the students. One can get such a report by adding the word DISTINCT to the SELECT query SELECT DISTINCT Major FROM Student What if the information in which one is interested is spread among several tables Such a query requires a JOIN of the tables. There is more than one way to specify a JOIN and there are different types of JOINs for different situations. Suppose one is interested in a list of student names and the names of the Resident Advisors in their dormitories. Here is one way to JOIN the Student and Dorm tables to combine the information SELECT Sname RA FROM Student Dorm WHERE Conceptually a JOIN works by concatenating .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
24    20    1    29-11-2024
272    23    1    29-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.