The Language of SQL- P8

The Language of SQL- P8:Research has shown that, being pressed for time, most readers tend to skip the introduction of any book they happen to read and then proceed immediately to the first real chapter. With that fact firmly in mind, we will only cover relatively unimportant material in the introduction, such as an explanation of what you will and will not learn by reading this book. | Literal Values 21 DATABASE DIFFERENCES MySQL and Oracle Both MySQL and Oracle will return a value in the header row for literal values. In MySQL the header for the first column in the previous example will appear as First Name In Oracle the header for the first column will appear as FIRSTNAME One question you might very well ask is why the header row is important at all. If you are using the SELECT statement to bring back data in a computer program then you probably don t care about the header. You only need the data. However if you are using the SELECT statement to retrieve data for a report displayed to a user either on paper or on a computer screen then the header might be relevant. After all when users look at a column of data they generally want to know the meaning of the column. In the case of a literal value there really is no meaning to the column so a header isn t truly necessary. But in other types of calculated fields there maybe a meaningful label that could be applied to the column. Later in this chapter we will discuss the concept of column aliases which is a way of providing a header in this type of situation. In addition to providing a column header where there is none column aliases also allow you to change the name of a column to something that may be more meaningful for the person viewing the data. For example a database designer may have given your last name column the obscure name of LstNm222. A column alias can be employed to change it to something more descriptive. One more point about literals. You might think that all literals need quotation marks but this is not necessarily true. For example the following statement SELECT 5 FirstName FROM Orders will return this data no column name FirstName 5 William 5 Natalie 5 Brenda 22 Chapters Calculations and Aliases Even though the literal value 5 is completely meaningless it is still a valid value. Since it doesn t have quote marks the 5 is interpreted as a numeric value. Arithmetic Calculations .

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
421    97    1    02-07-2024
38    92    2    02-07-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.