Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Creating a view combining two columns into one

 
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
);
 
Ranch Hand
Posts: 84
  • 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
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic