CSE 385 Chapter 3: Retrieving from Single Table
Document Summary
3 - how to retrieve data from a single table. To check dates in where: invoicedate between 2016-01-01" and. * in select clause retrieves all columns in table. Only do this when you need all for performance reasons. Separate column names with commas to retrieve specific columns. Also calculate values with arithmetic in select statement (invoicetotal - payments. To type single quote using escape: select vendorname + ""s address. Older versions used [invoice number] = invoicenumber. Arithmetic (+, -, *, /, %) operators evaluated in order of precedence. Functions: they perform operations and return value. Left(columnname, n)- returns n characters starting from left of data in the. Convert(totype, columnname, format)- converts the data in one column to another type. Distinct keyword: include after select word to eliminate duplicate rows. Automatically sorts by first column without using order by. Top clause: gives specific number of rows from beginning of result set.