2. Retrieving Data




-- Oefening 1

SELECT prod_name
FROM Products;

-- Oefening 2

SELECT prod_id, prod_name
FROM Products;

-- Oefening 3

SELECT vend_id
FROM Products;

SELECT DISTINCT vend_id
FROM Products;

Download hier het bestand.


-- Opdracht 1 | Vendors

/* Toon alle vend_name. */

-- vend_name
-- Bear Emporium 
-- Bears R Us
-- Doll House Inc. 
-- Fun and Games 
-- Furball Inc.
-- Jouets et ours

SELECT

-- Opdracht 2 | Vendors

/* Toon de vend_name, vend_city en vend_country. */

-- vend_name		vend_city	vend_country
-- Bear Emporium 	Anytown 	USA 
-- Bears R Us		Bear Town 	USA 
-- Doll House Inc. 	Dollsville	USA 
-- Fun and Games 	London		England 
-- Furball Inc.	New York		USA 
-- Jouets et ours	Paris 		France

SELECT

-- Opdracht 3 | Customers

/* Toon alle customers. */

-- cust_id		cust_name		cust_address			cust_city	cust_state	cust_zip	cust_country		cust_contact	cust_email
-- 1000000001	Village Toys	200 Maple Lane			Detroit 	MI 	44444 	USA 		John Smith			sales@villagetoys.com
-- 1000000002	Kids Place		333 South Lake Drive	Columbus	OH 	43333 	USA 		Michelle Green		NULL
-- 1000000003	Fun4All 		1 Sunny Place 			Muncie		IN 	42222 	USA 		Jim Jones 			jjones@fun4all.com 
-- 1000000004	Fun4All 		829 Riverside Drive 	Phoenix 	AZ 	88888 	USA 		Denise L. Stephens	dstephens@fun4all.com
-- 1000000005	The Toy Store 	4545 53rd Street		Chicago 	IL 	54545 	USA 		Kim Howard			NULL

SELECT 

-- Opdracht 4 | Products

/* Toon de eerste twee unieke vend_id. */

-- vend_id
-- BRS01 
-- DLL01 

SELECT 

Download hier het bestand.


-- Opdracht 1 | Vendors

/* Toon alle vend_name. */

-- vend_name
-- Bear Emporium 
-- Bears R Us
-- Doll House Inc. 
-- Fun and Games 
-- Furball Inc.
-- Jouets et ours

SELECT vend_name
FROM Vendors;

-- Opdracht 2 | Vendors

/* Toon de vend_name, vend_city en vend_country. */

-- vend_name		vend_city	vend_country
-- Bear Emporium 	Anytown 	USA 
-- Bears R Us		Bear Town 	USA 
-- Doll House Inc. 	Dollsville	USA 
-- Fun and Games 	London		England 
-- Furball Inc.	New York		USA 
-- Jouets et ours	Paris 		France

SELECT vend_name, vend_city, vend_country
FROM Vendors;

-- Opdracht 3 | Customers

/* Toon alle customers. */

-- cust_id		cust_name		cust_address			cust_city	cust_state	cust_zip	cust_country		cust_contact	cust_email
-- 1000000001	Village Toys	200 Maple Lane			Detroit 	MI 	44444 	USA 		John Smith			sales@villagetoys.com
-- 1000000002	Kids Place		333 South Lake Drive	Columbus	OH 	43333 	USA 		Michelle Green		NULL
-- 1000000003	Fun4All 		1 Sunny Place 			Muncie		IN 	42222 	USA 		Jim Jones 			jjones@fun4all.com 
-- 1000000004	Fun4All 		829 Riverside Drive 	Phoenix 	AZ 	88888 	USA 		Denise L. Stephens	dstephens@fun4all.com
-- 1000000005	The Toy Store 	4545 53rd Street		Chicago 	IL 	54545 	USA 		Kim Howard			NULL

SELECT *
FROM Customers;

-- Opdracht 4 | Products

/* Toon de eerste twee unieke vend_id. */

-- vend_id
-- BRS01 
-- DLL01 

SELECT DISTINCT TOP 2 vend_id
FROM Products;

-- MySQL
SELECT DISTINCT vend_id
FROM Products
LIMIT 2;

Download hier het bestand.