문제

I am new to SQL and really struggle just testing it out. My question is how do I derive data from one table to a new one keeping only specific data like: -Real name -Screen name

and also how do I create new variables using SQL. For example the Number of tweets that the person contributed.

도움이 되었습니까?

해결책

In MySQL, you would use create table as:

create table table2 as
    select RealName, ScreenName
    from table1;

However, you don't actually need to copy the data. You can just use a view instead:

create view table2 as
    select RealName, ScreenName
    from table1;

Or, just put the logic into your query.

다른 팁

SELECT ur specific column

INTO newtable

FROM oldtable;

check here for more examples

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top