Information about the data can be just as useful as the data itself. Find out how to ask these kinds of questions with DISTINCT, COUNT, and other SQL commands.
- [Instructor] Instead of just getting back records…that match our queries, we can use some other functions…and commands to change how the data is represented…and to find out more about the data itself.…First, let's take a look at ways of describing the data…by finding out how many records a response contains…and how long certain fields are.…I'll write a simple query here…to get the first name of everyone in our database.…Select first_name…from people.…
Alright,…but let's add…first_name here again and wrap it up with the…length function which will tell us how long…the information in a given field is…rather than the value of the field itself.…Here I can see Janice's name is six characters long.…Wanda is five, Laura is five and so on.…We can use that on some other fields too…if we wanted to explore a little bit.…It can be helpful to get a listing…of unique values in a field as well.…
We have a thousand rows here,…but I know there is many people…with the same first or last name.…Let's take a look at only pulling out the unique values,…
- Name the predicate of the following statement: SELECT EyeColor, Age FROM Student WHERE FirstName = 'Tim' ORDER BY LastName ASC;
- Explain what to use to enforce the order in which an expression must be evaluated if the WHERE clause contains multiple expressions to evaluate.
- Identify the best option to join two tables in a database to be able to display data from both.
- List a data type that is not numeric.
- Determine the result of running the following statement on a table containing columns col_1 and col_2:
- INSERT INTO Box (col_1, col_2) VALUES ('A', 'B'), ('A', 'B'), ('A', 'B'), ('A', 'B');
- Determine the best approach of deleting Jon Ramirez (ID 3452) from a Student table.