Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:00:32+00:00 2026-05-31T06:00:32+00:00

Given the table creation SQL and insertion SQL, How will I generate a query

  • 0

Given the table creation SQL and insertion SQL, How will I generate a query to display the information in a a particular way?

CREATE TABLE cities (
   id serial NOT NULL UNIQUE PRIMARY KEY,
   iname varchar(100) NOT NULL UNIQUE
)

CREATE TABLE suburbs (
    id serial NOT NULL UNIQUE PRIMARY KEY,
    icity integer REFERENCES cities (id), 
    iname varchar(100) NOT NULL UNIQUE
)
CREATE TABLE type (
   id serial NOT NULL UNIQUE PRIMARY KEY,
   iname varchar(100) NOT NULL UNIQUE
)
CREATE TABLE sale (
   id serial NOT NULL UNIQUE PRIMARY KEY,
   iname varchar(100) NOT NULL UNIQUE
)

CREATE TABLE estate (
    id serial NOT NULL UNIQUE PRIMARY KEY,
    icity integer REFERENCES cities (id),
    isuburb integer REFERENCES suburbs (id),
    itype integer REFERENCES type (id),
    isale integer REFERENCES sale (id),
    idescription text,
    itimestamp timestamp DEFAULT CURRENT_TIMESTAMP
)

INSERT INTO cities (iname) VALUES ('Johannesburg');
INSERT INTO suburbs (icity, iname) VALUES (1, 'Westbury');
INSERT INTO type (iname) VALUES ('Room');
INSERT INTO sale (iname) VALUES ('Rent');

INSERT INTO estate (icity, isuburb, itype, isale, idescription) VALUES (1, 1, 1, 1, 'A Nice place in a real bad neighbor hood');

Now I want the numerical values that are in the table estate to be displayed by the string values that they represent.

E.G
1 Johannesburg, Westbury, Room, Rent, Description

What will the SQL Query be for this, I am more concerned in using postgreSQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:00:34+00:00Added an answer on May 31, 2026 at 6:00 am

    First, they must have some sort of common field. Let’s assume the common field between them is called <tablename>_ID; the way you do it is as follows:

    select A.colx, A.coly, A.colz, B.colx, B.colw, c.cold 
    from A inner join B on A.ID=B.A_ID 
         inner join C on C.A_ID=A.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a given table 'foo', I need a query to generate a set of
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
Given a table such as: CREATE TABLE dbo.MyTestData (testdata varchar(50) NOT NULL) ALTER TABLE
Given a (simplified) table CREATE TABLE `transactions` ( `ID` bigint(20) NOT NULL AUTO_INCREMENT, `CREATION_DT`
Following is my db creation code. @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE TABLE
I used the SQL Server management studio on a table with Create Script to
I'd quite like to use ADO.NET to generate a CREATE TABLE script to create
I am trying to link two fields of a given table to the same
Given a table (mytable) containing a numeric field (mynum), how would one go about
Given a table or a temp table, I'd like to run a procedure that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.