Always write your codes in Notepad++ first, and then copy and paste them into Or
ID: 3904894 • Letter: A
Question
Always write your codes in Notepad++ first, and then copy and paste them into Oracle to test them. While using Notepad++, click Language -> S -> SQL. This can help you catch syntax errors.
Your team submission should include two files:
1) a Notepad++ file (.sql) containing your codes, and
2) a Word file (.doc/.docx) showing screen shots of your codes AND results from Oracle.
9. Truncate the EMPLOYEES table. Then verify that the table structure remains intact.
10. Delete the EMPLOYEES table so that it can be restored. Restore the table. Then delete the table permanently so that it is not moved to the recycle bin.
2. Change the STORE_REPS table so that null values can’t be entered in the first and last name columns.
4. Add a column named Base_salary with a datatype of NUMBER(7,2) to the STORE_REPS table. Ensure that the amount entered is above zero.
Ch3 Hands on practice 2. Create a new table containing these four columns: Emp#, Lastname, Firstname, and Job class. The table name should be EMPLOYEES. The Job class column should be able to store character strings up to a maximum length of four, but the column values shouldnt be padded if the value has less than four characters. The Emp# column contains a numeric ID and should allow a five-digit number. Use column sizes you consider suitable for the Firstname and Lastname columns. Add two columns to the EMPLOYEES table. One column, named EmpDate, contains the date of employment for each employee, and its default value should be the system date. The second column, named EndDate, contains employees' date of termination. Modify the Job_class column of the EMPLOYEES table so that it allows storing a maximum width of two characters 3. 4.Explanation / Answer
If you have any doubts, please give me comment...
CREATE TABLE EMPLOYEES(
Emp# INTEGER NOT NULL PRIMARY KEY,
Lastname VARCHAR(50),
Firstname VARCHAR(50),
Job_class CHAR(4)
);
ALTER TABLE EMPLOYEES ADD EmpDate TIMESTAMP, ADD EndDate DATE;
ALTER TABLE EMPLOYEES MODIFY Job_class CHAR(2);
TRUNCATE TABLE EMPLOYEES;
DROP TABLE EMPLOYEES;
ALTER TABLE ACCTMANAGER ADD Comm_id NUMBER(2) DEFAULT 10, ADD Ben_id NUMBER(2);
ALTER TABLE store_reps MODIFY rep_ID NUMBER(5) PRIMARY KEY, MODIFY comm CHAR(1) DEFAULT 'Y';
ALTER TABLE store_reps CHANGE last last VARCHAR(15) NOT NULL, CHANGE first first VARCHAR(15) NOT NULL;
ALTER TABLE store_reps ADD Base_salary NUMBER(7,2) CHECK Base_salary>0;
CREATE TABLE Project(
Proj# NUMBER(3) NOT NULL PRIMARY KEY,
P_name VARCHAR(50) UNIQUE KEY,
P_desc VARCHAR(255),
P_budget NUMBER(7,2)
);
CREATE TABLE Workorders(
Wo# NUMBER(3) NOT NULL PRIMARY KEY,
Proj# NUMBER(3),
Wo_desc VARCHAR(255),
Wo_assigned VARCHAR(100),
Wo_hours INTEGER CHECK Wo_hours>0,
Wo_start DATE,
Wo_due DATE,
Wo_complete CHAR(1),
FOREIGN KEY(Proj#) REFERENCES Project(Proj#)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.