IT: select statement in SQL

So what is the benefit of SQL, also known as Oracle? Well you can keep track of your customers records easily for one thing. Second, it is secure, so no one, unless you give them permission, will access this information. Below you will see one of the basics of SQL.

How to find data inside two specific columns in SQL:

Example: What are the ice cream flavors that use ingredient 1100?

select  (Ice_cream_flavor) from ICECREAM WHERE Ice_cream_ID in

(select Ice_cream_ID  from RECIPE where Ingredient_ID = ‘1100’) ;

Output:

SQL> select Ingredient_name from INGREDIENT where Ingredient_ID in (select Ingredient_ID from RECIPE where Ice_cream_ID  IN  (201, 540));

 

INGREDIENT_NAME

——————

Vanilla beans

Tea leaves

Sugar

cocoa

Raw almonds

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s