Concept explainers
Display values from table:
The contents from the table can be viewed by using “SELECT” statement which comes under Data Manipulation Language (DML).
The Syntax to view the contents using asterisk (*) is as follows:
SELECT * FROM table_Name;
Selective columns can also be retrieved by replacing all the column(s) names in place of the asterisk symbol.
WHERE Statement:
“WHERE” statement is used limit the number of rows.
For example: Consider a table “FTable” that has two columns named “FruitName” and “Color”. “WHERE” clause is used when there is a need to display the entire FruitName whose color is Red.
SELECT * FROM FTable WHERE color = 'red';
When the above statement is executed, red colored fruits get displayed.
LIKE operator:
“LIKE” operator is used to get set of values which matches the set of characters. The “LIKE” operator uses “%” sign and it uses underscore (_) which is used to represent the characters.
Syntax:
SELECT * FROM table_Name WHERE column_Name LIKE pattern;
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Database Concepts (7th Edition)
- Write an SQL statement to display the last name, first name, and email of any owners of cats. Use a subqueryarrow_forwardWrite an SQL statement to display the PetBreed column of PET.arrow_forwardWrite an SQL statement to display the name and breed of all pets, sorted by PetBreed in ascending order and by PetName in descending order within PetBreedarrow_forward
- Write an SQL statement to display the last name, first name, and email of any owners of cats with the name Teddy. Use a subqueryarrow_forwardComputer Science SQL Computer science question: Write out a scenario where you would constrain and validate the user input to prevent a SQL injection attack. Explain what the input is, and write the code snippet showing how you validated it.arrow_forwardWrite an SQL statement to create a table named Car. The Car table should have the columns to hold a car’s manufacturer, year model, and a 20-character vehicle ID number.arrow_forward
- Write SQL statements to the following queries. Retrieve customer FULL_NAME which full name (starts with uppercase letter N and end with lowercase letter i) or (starts with uppercase letter K and end with lowercase letter d) in ascending order of FULL_NAME.arrow_forwardWrite an SQL statement to display the pet ID, breed, and type for all pets having a four-character name starting with K.arrow_forwardWrite only the SQL statement needed to insert the following author into the database: Lastname: Duck Initials: D. Affiliation: Disney email: Donald@disney.comarrow_forward
- Consider the following table. Kids (id: string, race: string, height: numeric, weight: numeric, age: integer, gender. string) Task: Write a SQL statement to retrieve all information of female kids taller than 150 CM.arrow_forward8. Prepare SQL statement to find more than ONE (1) students supervised by an advisor. Display advisor name and number of advisee. Label the columns as AdvisorName, and NumberofSupervision respectively. SQL statements:arrow_forwardWrite an SQL statement to display the breed and type of all pets.arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning