Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating a view combining two columns into one

 
Paul Kennerley
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have two tables as shown below, could anyone tell me if and how its possible to create a view
that has only one column that contains the dbName values from both the tutor and student tables?

Thanks in advance

CREATE TABLE tutor
(
dbId INTEGER ,
dbName VARCHAR(20),
dbEmail VARCHAR(20),
dbPassword VARCHAR(8)NOT NULL
);



CREATE TABLE student
(
dbId INTEGER NOT NULL PRIMARY KEY,
dbName VARCHAR(20),
dbCourse VARCHAR(20),
dbPassword VARCHAR(8) NOT NULL,
dbPersonalTutorId INTEGER NOT NULL
);
 
Jon Egan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,

Look into using two queries combined with UNION.... and check into the difference between UNION and UNION ALL, to be sure you use the right one.

Hope this helps,
-- Jon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic