Question
SQL in Oracle. This is a two part question with a little backgound. This is what I did for 5-2 (which is used for the
SQL in Oracle.
This is a two part question with a little backgound.
This is what I did for 5-2 (which is used for the question I need help with).
SQL> create table Stutab (
2 "stno" number (38),
3 "sname" varchar2(20),
4 "major" varchar(4),
5 "class" number (38),
6 "bdate" date
7 );
Table created.
SQL> INSERT INTO Stutab
2 SELECT *
3 FROM stutable;
48 rows created.
This is what I did for 5-2c (which is used for the question I need help with).
SQL> create view vstu AS
2 select sname, major
3 from Stutabl
4 where major = 'COSC';
View created.
This is the Student Table we are using for all our assignments which has been pre-loaded and saved into our Oracle account:
stdnt
stno NOT NULL NUMBER (3)
PRIMARY KEY NOT NULL
sname VARCHAR2(20)
major CHAR(4)
class NUMBER(1)
bdate DATE
grdrpt
student_number NOT NULL NUMBER(3)
section_id NOT NULL NUMBER(6)
grade CHAR(1)
PRIMARY KEY (student_number, section_id)
sctn
section_id NOT NULL NUMBER(6)
PRIMARY KEY NOT NULL
course_num CHAR(8)
semester VARCHAR2(6)
year CHAR(2)
instructor CHAR(10)
bldg. NUMBER(3)
room NUMBER(3)
dptmaj
dcode NOT NULL CHAR(4)
PRIMARY KEY NOT NULL
dname CHAR(20)
crs
course_name CHAR(20)
course_number NOT NULL CHAR(8)
PRIMARY KEY NOT NULL
credit_hours NUMBER(2)
offering_dept CHAR(4)
rm
bldg NOT NULL NUMBER(3)
room NOT NULL NUMBER(3)
capacity NUMBER(4)
ohead CHAR(1)
PRIMARY KEY (bldg., room)
preq
course_number CHAR(8)
prereq CHAR(8)
PRIMARY KEY (course_number,prereq)
This is the question I need help with.
5-3
Part 1). Repeat the CREATE VIEW part of the excercise in 5-2c with a column name in the cREATE OR REPLACE VIEW statement like this: CREATE OR REPLACE VIEW vs (Na, Ma) SELECT...using the Stutab table you creted in 5-2. Display the view. What is the effect of the 9Na, Ma)?
Part 2). Repeat the above (Part 1), but this time use column aliases in the view defination. Are there any differences noted between explicity defining the view columns in the heading part of the statement versus using a column in alias?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started