Question

In: Computer Science

Assignment 3 Note: Tables referred in this assignment are same as that of Assignment 2. 1....

Assignment 3 Note:

Tables referred in this assignment are same as that of Assignment 2.

1. For each table, append your student id along with the table name. For e.g. employee_student id (employee_T16363737)

2. Format for questions: a. Question: b. SQL statement solution c. Screenshot for correct input d. Screenshot for violation (if any)

Q1) Check the structure of tables.

Q2) Check the constraint name for applied constraints?

Q3) Drop the unique constraint on ENAME

Q4) Drop the Foreign Key constraint on DEPTNO

Q5) Add Foreign Key constraint on DEPTNO

Q6) Change Data type of ENAME. (If previously you have marked it as VARCHAR 2, then make it CHAR or vice versa)

Q7) Change width of DNAME ( For e.g. If you have defined it’s size has 20 then make it 30)

Q8) Add COMM column in EMP table

Q9) Drop CITY column from S table

Q10) Create duplicate copy of EMP table

Q11) Copy structure of DEPT table in another table with different column names

Q12) Change the name and job of the employee whose EMPNO =100

Q13) Delete the record of employee who belong to computer department

Q14) Drop DEPT Table

Q15) Drop duplicate table of EMP table

Solutions

Expert Solution

1)

SELECT * FROM INFORMATION_SCHEMA.COLUMNS

WHERE TABLE_NAME='tableName';   //for one particular table

OR

SELECT TABLE_NAME FROM   INFORMATION_SCHEMA.TABLES // it will return all the tables in the database that we are querying.

2)

    SELECT CONSTRAINT_NAME, SEARCH_CONDITION AS CONSTRAINT_TYPE

    FROM USER_CONSTRAINTS

    WHERE TABLE_NAME='XYZ’;

3)

(ALTER TABLE table_name DROP CONSTRIANT constraint name;) ALTER TABLE EMP DROP CONSTRAINT ENAME;

4)

ALTER TABLE EMP

DROP CONSTRAINT FK_name;

5)

Suppose we need to create a foreign key constraint on “deptno” when EMP table is already created,        ALTER TABLE EMP

ADD FOREIGN KEY (DEPTNO) REFERENCES DEPT(DEPTNO);

6)

Changing datatype of column ENAME varchar to char in table EMP

ALTER TABLE EMP

ALTER COLUMN ENAME CHAR(size);

7)

Changing size of column DNAME from 20 to 30 in table DEPT

ALTER TABLE DEPT

ALTER DNAME VARCHAR (30);

8)

Adding COMM column in table EMP

    ALTER TABLE EMP

    ADD (COMM);

9)

ALTER TABLE S

DROP COLUMN CITY;

10)

     CREATE TABLE copy_emp SELECT * FROM EMP;

11)
   SELECT * INTO copy_dept  FROM DEPT;  ( Its only create copy of dept table)

     INSERT INTO copy_dept(Dept_Name, Department) SELECT DName, Dpt FROM DEPT;

 

12)

    SELECT name, job FROM EMP WHERE EMPNO=100;

13)

   DELETE From EMP

    WHERE DEPARTMENT_NAME = 'COMPUTER';

14)

    DROP TABLE DEPT;

15)

   DROP TABLE copy_emp;


Related Solutions

QUESTION 3 (20 Marks) NOTE: Where present value tables are required, use tables with 4 decimal...
QUESTION 3 NOTE: Where present value tables are required, use tables with 4 decimal places. REQUIRED Study the information given below and answer the following questions without the use of a financial calculator: 3.1 Calculate the Payback Period of Project B. (Answer must be expressed in years, months and days.) 3.2 Calculate the Average Rate of Return of Project B. (Express your answer to two decimal places.) 3.3 Calculate the Net Present Value of both projects. (Round off amounts to...
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 and...
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 and in a bullet list or narrative.        Discussion: Specifically address the different policy recommendations specifically between the Keynesian and Monetarist/classical school for getting the economy out of the recession. What about the rational expectations school adjustment process? What are some of the key assumptions of the rational expectations with regards to the business cycle and the flexibility of prices and wages?
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 and...
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 and in a bullet list or narrative.        Discussion: Specifically address the different policy recommendations specifically between the Keynesian and Monetarist/classical school for getting the economy out of the recession. What about the rational expectations school adjustment process? What are some of the key assumptions of the rational expectations with regards to the business cycle and the flexibility of prices and wages?
Accounting II AC2034 ASSIGNMENT 2 PAYROLL Please Note: This assignment is an INDIVIDUAL assignment The payroll...
Accounting II AC2034 ASSIGNMENT 2 PAYROLL Please Note: This assignment is an INDIVIDUAL assignment The payroll records of Acme Company provided the following information for the weekly pay period ended March 20, 2020: Employee     Employee     Hours Worked         Rate of Pay Hospital        Union             Earnings to End    Name                No            For Week                                          Insurance     Dues             of Previous Week Bugs Bunny       40                    40                            $34                   $30.00        $12.00           $43,000 Sylvester            50                    42                              36            ...
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 both...
Graphically illustrate a recession and note the steps 1 to 2 and 2 to 3 both on the graphs and in a bullet list or narrative. a. identify the adjustment mechanism if policy is anticipated (per rational expectations) b. identify the Keynesian policy recommendations
1. 9 trumpet players blast the same note with the same intensity for as long as...
1. 9 trumpet players blast the same note with the same intensity for as long as possible. After a period of time, 3 trumpet players exhaust their breath and stop playing; what is the loudness of the remaining trumpet players is decreased by: Hint: The sound intensity is decreased by a factor of 3 after 3 of the 9 trumpet players cease playing. 2. A surgical laser imparts 5.0X10 2J for 10.ns upon a 1.0mm 2 surface of a tumor....
1. _____ - _____is often referred to as heat.? 2. Total Potential Energy equation is? 3.What...
1. _____ - _____is often referred to as heat.? 2. Total Potential Energy equation is? 3.What is the equation for electric power?
The prior probabilities for events are ?1, ?2,and?3?(?1)=0.20, ?(?2)=0.50,?(?3)=0.30. (Note the events are mutually exclusive and...
The prior probabilities for events are ?1, ?2,and?3?(?1)=0.20, ?(?2)=0.50,?(?3)=0.30. (Note the events are mutually exclusive and collectively exhaustive). The conditional probabilities of event B given are ?1, ?2,and?3?(?|?1)=0.50, ?(?|?2)=0.40,?(?|?3)=0.30 1. Compute and .?(?⋂?1), ?(?⋂?2) and ?(?⋂?3) 2. Compute ?(?) 3. Apply Bayes’ theorem to compute the posterior probability, and .?(?1|?), ?(?2|?) and ?(?3|?)
Assignment: Enter a linear series of numbers 1, 2, 3, . . . . . 100...
Assignment: Enter a linear series of numbers 1, 2, 3, . . . . . 100 in column A from A1 to A100. Enter a second series of numbers 20, 22, 24, . . . . . 218 in Column “B” from B1 to B100. Plot Column “B” as a function of column “A”. Use a linear trend-line and find the equation of the line. Specify the slope and the y-intercept of the line. Save your file and submit it...
1. Deposit in transit. 2. Collection of note receivable by bank. 3. Bank’s recording of a...
1. Deposit in transit. 2. Collection of note receivable by bank. 3. Bank’s recording of a cash receipt that did not belong to Davis Co. 4. Book recording of a check in the general ledger for $10,000 for an equipment purchase for which the actual check amount and purchase price was $1,000. 5. Outstanding checks. 6. A debit memorandum from the bank for an NSF check received from a customer. 7. A credit memorandum indicating interest was credited to Davis...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT