IFS Intro to Data Management Chapter 5 Getting More Than Simple Columns
Select Statement – Revisited General format of SELECT statement (IE. Major clauses) Two required Major clauses Required punctuation Define a duplicate row and how do we eliminate a duplicate row How is column sequencing accomplished
Data Types / Literals– Reviewed What is a literal Examples of Character and Numeric literal Character require single quotes, numeric does not Data Types Character Numeric Date
Expression / Function Building Character Mathematical Date / Time Arithmetic
Character Expressions and Functions Concatenation – Joining character columns / literals together Note: SQL = ||, Access = &, Oracle = CONCAT Substring function Length Function Count Function Not strictly numeric In String function Left Pad Function
Character and Numeric Operations CAST function Used to convert a column reference or literal into a specified data type Why? Notice that Access does not require (as indicated by your authors). However, it is dependant on the DBMS being used.
Mathematical Expressions / Functions Order of Precedence: Multiplication (*) and Division (/) Addition (+) and Subtraction (-) Left to Right evaluation Parentheses (…) to control evaluation
Number Functions Round – Round value to specified value Round( ,0) 80 Trunc – Truncate value to specified decimal Trunc( ,0) 79 Mod – Returns the remainder of division Mod(1600/300) 100
Data and Time Arithmetic Additional and Subtraction only Use only DATE or Non-decimal numeric data types Subtract dates from one another ONLY (cannot add dates) Add numbers to dates Time functions similarly
Null Values The value that’s not a value Missing or unknown *** Not a blank or zero Examples (which represents Null)? ‘ ‘, 000, ‘’, ‘ ‘ Null values can be useful, especially when determining missed values (also when joining tables)