SQL - Create view from multiple tables

后端 未结 4 377
被撕碎了的回忆
被撕碎了的回忆 2020-12-09 21:08

I have three tables:

POP(country, year, pop)
FOOD(country, year, food)
INCOME(country, year, income)

I am trying to create a view such as:<

4条回答
  •  孤街浪徒
    2020-12-09 21:38

    This works too and you dont have to use join or anything:

    DROP VIEW IF EXISTS yourview;
    
    CREATE VIEW yourview AS
        SELECT table1.column1, 
        table2.column2
    FROM 
    table1, table2 
    WHERE table1.column1 = table2.column1;
    
    

提交回复
热议问题