SQL VISUAL QUICKSTART GUIDE- P16

SQL VISUAL QUICKSTART GUIDE- P16:SQL (pronounced es-kyoo-el) is the standard programming language for creating, updating, and retrieving information that is stored in databases. With SQL, you can turn your ordinary questions (“Where do our customers live?”) into statements that your database system can understand (SELECT DISTINCT city, state FROM customers;) | Chapter 5 Performing Arithmetic Operations Performing Arithmetic Operations A monadic or unary arithmetic operator performs a mathematical operation on a single numeric operand to produce a result. The - negation operator changes the sign of its operand and the not-very-useful identity operator leaves its operand unchanged. A dyadic or binary arithmetic operator performs a mathematical operation on two numeric operands to produce a result. These operators include the usual ones addition - subtraction multiplication and division . Table lists SQL s arithmetic operators expr is a numeric expression . To change the sign of a number Type -expr expr is a numeric expression Listing and Figure . Table Arithmetic Operators Operator What It Does -expr Reverses the sign of expr expr Leaves exprunchanged xxprl e xxpr2 Sums expri and expr2 xxprl - xxpr2 Subtracts expr2 from expri xxprl xxpr2 Multiplies expri and expr2 xxprl xxpr2 Divides expri by expr2 Listing The negation operator changes the sign of a number. See Figure for the result. Listing SELECT title_id -advance AS Advance FROM royalties title_id Advance T01 T02 T03 T04 T05 T06 T07 T08 T09 T10 NULL T11 T12 T13 Figure Result of Listing . Note that zero has no sign is neither positive nor negative . 130 Operators and Functions Listing List the biographies by descending revenue price x sales . See Figure for the result. Listing SELECT title_id price sales AS Revenue FROM titles WHERE type biography ORDER BY price sales DESC title_id Revenue T07 T12 T06 T10 NULL Figure Result of Listing . Other Operators and Functions All DBMSs provide plenty of operators and functions in addition to those defined in the SQL standard or covered in this book . In fact the standard is playing catch-up many of the functions introduced in the latest .

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
Đã 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.