473,320 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

real challenge!

Here is a real challenge! Can you help me , your fellow mate?
Deven has written the SQL program, shown in Figure 2, which follows. I
intends to compute the total tuition of a class of students from a database table
that I created earlier. However, I accidentally erased the database and now is seeking your help to reconstruct the database. I did however retain the
original datasheet, as shown in Figure 1 below, that I based my database table upon. Can you check both his program code and his datasheet to determine the required field names and datatypes that are necessary to include in the table so that
I can successfully run his program and obtain the required output

Figure 1 Deven’s Original Datasheet

Student ID Last Name First Name Major Course
101 Andrews Arthur Computers Mathematics
102 Benson Bobby Business Computers
103 Boyce Barbara Accounting Science
104 Connors Carol Telecommunications History
105 Daniels Debbie Telecommunications Psychology
106 Daniels Denise Business Marketing

---------------------------------------------------------------------------------------------
Figure 2 Deven's Program Code

SET SERVEROUTPUT ON;
SET VERIFY OFF;

DECLARE
V_ID NUMBER:=&SV_ID;
V_TOTAL NUMBER;
V_COST CONSTANT NUMBER:=2700;
V_COUNT NUMBER;
V_FIRST STUDENT.STUDENT_FIRST_NAME %TYPE;
V_LAST STUDENT.STUDENT_LAST_NAME %TYPE;

BEGIN
SELECT TO_CHAR (COUNT(STUDENT_ID))
INTO V_COUNT
FROM ENROLMENT
WHERE STUDENT_ID = V_ID;
V_TOTAL:=V_COUNT * V_COST;

SELECT STUDENT_FIRST_NAME,STUDENT_LAST_NAME
INTO V_FIRST,V_LAST
FROM STUDENT
WHERE STUDENT_ID = V_ID;

DBMS_OUTPUT.PUT_LINE ('STUDENT NAME: '||V_FIRST||' '||V_LAST);

DBMS_OUTPUT.PUT_LINE ('STUDENT ID: '||V_ID);

DBMS_OUTPUT.PUT_LINE ('TOTAL TUITION IS: '||V_TOTAL);

END;
Nov 21 '06 #1
2 1421
pragatiswain
96 Expert
Probably these were the tables involved based on the data sheet and procedre.

CREATE TABLE STUDENT(
STUDENT_ID NUMBER(10) PRIMARY KEY,
STUDENT_FIRST_NAME VARCHAR2(50),
STUDENT_LAST_NAME VARCHAR2(50)
);

CREATE TABLE ENROLMENT(
STUDENT_ID NUMBER(10),
COURSE_ID NUMBER(5)
);

CREATE TABLE COURSE(
COURSE_ID NUMBER(5),
COURSE_NAME VARCHAR2(100)
);

Hope this helps.
Nov 22 '06 #2
Probably these were the tables involved based on the data sheet and procedre.

CREATE TABLE STUDENT(
STUDENT_ID NUMBER(10) PRIMARY KEY,
STUDENT_FIRST_NAME VARCHAR2(50),
STUDENT_LAST_NAME VARCHAR2(50)
);

CREATE TABLE ENROLMENT(
STUDENT_ID NUMBER(10),
COURSE_ID NUMBER(5)
);

CREATE TABLE COURSE(
COURSE_ID NUMBER(5),
COURSE_NAME VARCHAR2(100)
);

Hope this helps.


hey it works
Thank you very much.
Deven
Nov 28 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Brian Murphy | last post by:
<?php /* A challenge to every PHP programmer.The one who's gonna solve this problem would be deemed as PSP(PHP Supreme Programmer).The problem is this : You have to write a script that...
4
by: Andreas | last post by:
Hi! I'm writing a program that has support for multiple language, so far swedish and english is requested. Everything is fine, but the program has to be able to run on computers with...
2
by: Ken | last post by:
This is a challenge. Perhaps someone can offer suggestions. I am trying to create a variable, ordernumber, that increases by an increment of 1 every time the variable is accessed. For...
8
by: Frank Buss | last post by:
A new challenge: http://www.frank-buss.de/marsrescue/index.html Have fun! Now you can win real prices. -- Frank Buß, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
30
by: Raymond Hettinger | last post by:
Proposal -------- I am gathering data to evaluate a request for an alternate version of itertools.izip() with a None fill-in feature like that for the built-in map() function: >>> map(None,...
0
by: Richard Jones | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from...
0
by: richard | last post by:
The date for the second PyWeek challenge has been set: Sunday 26th March to Sunday 2nd April (00:00UTC to 00:00UTC). The PyWeek challenge invites entrants to write a game in one week from...
3
by: Rex | last post by:
Hi - I have been looking for a solution to a particular User Interface challenge for a long time. I have not posted this question here previously - and I am now wondering if anyone can offer me...
3
by: Thierry | last post by:
For those interested in <b>programming riddles</b>, I would like to announce a new programming challenge I'm just launching at http://software.challenge.googlepages.com This challenge is in its...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.