SQL

作者: Cherryjs | 来源:发表于2017-05-12 23:22 被阅读0次

    1.UPDATE celebsSET age = 22

    WHERE id = 1;

    SELECT * FROM celebs

    2.ALTER TABLE celebs ADD COLUMN twitter_handle TEXT;

    SELECT*FROM celebs;

    3.UPDATE celebs

    SET twitter_handle='@taylorswift13'

    WHERE id=4;

    SELECT *FROM celebs;

    4.SELECT price, ROUND(AVG(downloads), 2) FROM fake_apps

    GROUP BY price;

    5.CREATE TABLE artists(id INTEGER PRIMARY KEY, name TEXT)

    6.SELECT* FROM albums

    JOIN artists ON albums.artist_id=artists.id;

    7.SELECT * FROM albums

    LEFT JOIN artists ON

    albums.artist_id=artists.id;

    8.SELECT

    albums.name AS 'Album',

    albums.year,

    artists.name AS 'Artist'

    FROM

    albums

    JOIN artists ON

    albums.artist_id=artists.id

    WHERE

    albums.year>1980.

    相关文章

      网友评论

        本文标题:SQL

        本文链接:https://www.haomeiwen.com/subject/sljgtxtx.html