Select Distinct

SELECT state FROM address WHERE addressType = ‘P’ AND endDate = ‘0000-00-00’; State SC SC SC MA Sometimes the returned results of your select statement may contain duplicate information. The example above demonstrates what happens when querying the address table without the DISTINCT keyword. The address table may contain several […]

Concatenation

A concatenation is the combining of two or more columns, expressions, or literal strings to display combined data in one column. The MySQL function for concatenation is CONCAT. For example: CONCAT( expression_1, ‘ ‘, expression_2 ) where expression_1 and expression_2 are either column names, expressions, or literal strings separated by a delimiter. […]

Filtering and Selection Criteria

Introduction By filtering and using selection criteria, you can leverage the relationships within a relational database to limit your results. The queries we’ve been using until now have been retrieving all rows from the database. However, in most situations, you want your queries to return a subset of information instead […]

Functions

Functions help analyze data by performing a set of operations to manipulate data. They perform operations and may take an argument. Arguments are columns from tables fed into the function from a query statement. There are two main groups of SQL functions: Scalar functions are single input and single output. Aggregate […]