SQL6.docx - *6.1* SQL> CREATE TABLE table1 ( 2 A CHAR(2), 3...

This preview shows page 1 - 5 out of 12 pages.

The preview shows page 3 - 5 out of 12 pages.
***6.1**********************SQL> CREATE TABLE table1 (2A CHAR(2),3B CHAR(2));Table created.**********************SQL> INSERT INTO table12VALUES ('x1', 'y1');1 row created.**********************SQL> INSERT INTO table12VALUES ('r1', 's1');1 row created.**********************SQL> CREATE TABLE table2 (2A CHAR(2),3B CHAR(2),4C VARCHAR2(2),5D VARCHAR2(3));Table created.**********************SQL> INSERT INTO table22VALUES ('x2', 'y2', 'z2', 'w2');1 row created.**********************SQL> INSERT INTO table22VALUES ('r2', 's2', 'T2', 'u2');1 row created.***6.1a**********************SQL> SELECT * FROM table1 UNION SELECT * FROM table2;SELECT * FROM table1 UNION SELECT * FROM table2*ERROR at line 1:ORA-01789: query block has incorrect number of result columns
***6.1b**********************SQL> SELECT * FROM table1 UNION SELECT A, B FROM table2;AB------ ------r1s1r2s2x1y1x2y2***6.1c**********************SQL> SELECT * FROM table1 UNION SELECT B, A FROM table1;AB------ ------r1s1s1r1x1y1y1x1***6.1d**********************SQL> SELECT * FROM table1 UNION SELECT A, C FROM table2;AB------ ------r1s1r2T2x1y1x2z2***6.1e**********************SQL> SELECT * FROM table1 UNION SELECT A, D FROM table2;AB------ ---------r1s1r2u2x1y1x2w2***6.1f**********************SQL> CREATE OR REPLACE VIEW viewxAS2SELECT A, B FROM table2;View created.
***6.1g**********************SQL> SELECT * FROM table1 UNION SELECT * FROM viewx;AB------ ------r1s1r2s2x1y1x2y2***6.2a**********************SQL> SELECT stno, sname, class, course_num2FROM sec3INNER JOIN grade4ON sec.SECTION_ID = grade.SECTION_ID5INNER JOIN stu6ON grade.STUDENT_NUMBER = stu.STNO7WHERE grade = 'B'8AND course_num LIKE 'COSC%';STNOSNAMECLASSCOURSE_NUM---------- ------------------------------------------------------------ ---------- ------------------------24Chris4COSC20253Mary4COSC20252Lineas1COSC3320STNOSNAMECLASSCOURSE_NUM---------- ------------------------------------------------------------ ---------- ------------------------14Lujack1COSC33208Brenda2COSC332015Reva2COSC3320STNOSNAMECLASSCOURSE_NUM---------- ------------------------------------------------------------ ---------- ------------------------19Harley2COSC33202Lineas1COSC131014Lujack1COSC1310STNOSNAMECLASSCOURSE_NUM---------- ------------------------------------------------------------ ---------- ------------------------15Reva2COSC1310
25 rows selected.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 12 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
Brooks
Tags
Educational years, Brenda

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture