Remember --- need both the SQL and the output to get any marks. Question 2 Reminder === > Issue SET PAGESIZE 200 at beginning of your session. Display the (1) customer number, (2) customer name and (3) country code for all the customers that are in the Germany. Look up th country code for Germany. Table used is CUSTOMERS Please note that the user is to enter the 2 character country code AND that they if they were doing Canade they can enter it as CA, Ca, ca, cA meaning any combitaion. Your SQL must allow for various user inputs of the code. Do not make the user enter it the way you want such as CA only. Be flexible and helpful. Also do not use a lot of OR statements to get around the requirements. NOTE: the user is not entering the country name.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  1. Remember --- need both the SQL and the output to get any marks.

    Question 2

    Reminder === > Issue SET PAGESIZE 200 at beginning of your session.

    Display the (1) customer number, (2) customer name and (3) country code for all the customers that are in the Germany. Look up th country code for Germany. Table used is CUSTOMERS

    Please note that the user is to enter the 2 character country code AND that they if they were doing Canade they can enter it as CA, Ca, ca, cA meaning any combitaion.

    Your SQL must allow for various user inputs of the code. Do not make the user enter it the way you want such as CA only. Be flexible and helpful. Also do not use a lot of OR statements to get around the requirements.

    NOTE: the user is not entering the country name.

Expert Solution
Step 1

Table Creation and Insertion:

CREATE TABLE COUNTRY(
countryCode VARCHAR(2) PRIMARY KEY,
countryName VARCHAR(50)
)

INSERT INTO COUNTRY VALUES('DE','Germany');
INSERT INTO COUNTRY VALUES('UK','United Kingdom');
INSERT INTO COUNTRY VALUES('CA','Canada');


CREATE TABLE CUSTOMERS(
customerNumber INT PRIMARY KEY,
customerName VARCHAR(50),
City VARCHAR(50) ,
countryCode VARCHAR(2),
FOREIGN KEY(countryCode) REFERENCES COUNTRY(countryCode)
)


INSERT INTO CUSTOMERS VALUES(100,'John','Georgia','UK')
INSERT INTO CUSTOMERS VALUES(200,'Mallick','Downtown','DE')
INSERT INTO CUSTOMERS VALUES(300,'Inba','Ohio','DE')
INSERT INTO CUSTOMERS VALUES(400,'Albery','Kallu','CA')
INSERT INTO CUSTOMERS VALUES(500,'Lally','Duluth','dE')

 

Question 2

Display the (1) customer number, (2) customer name and (3) country code for all the customers that are in the Germany. Look up th country code for Germany. Table used is CUSTOMERS

Query:

  • Since SQL is case insensitive, no need to specify countryCode as DE,de,De,dE separately

!-- Query For Question 2
SELECT customerNumber, customerName , countryCode FROM CUSTOMERS WHERE countryCode in ('DE')

 

Sample Run:

 

1
Results i Messages
customerNumber customerName countryCode
1
200
Mallick
DE
2 300
Inba
DE
3
500
Lally
dE

 

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education