美文网首页
MySQL Demo 01

MySQL Demo 01

作者: GeekGray | 来源:发表于2018-10-04 11:54 被阅读17次

    阅读原文

    MySQL Demo 01

    1. 下面的语句是否可以执行成功

    SELECT last_name , job_id , salary AS sal
    FROM employees; 
    

    2.下面的语句是否可以执行成功

    SELECT  *  FROM employees; 
    

    3.找出下面语句中的错误

    SELECT employee_id , last_name,
    salary * 12 AS "ANNUAL  SALARY"
    FROM employees;
    

    4.显示表departments的结构,并查询其中的全部数据

    DESC departments;
    SELECT * FROM `departments`;
    

    5.显示出表employees中的全部job_id(不能重复)

    SELECT DISTINCT job_id FROM employees;
    

    6.显示出表employees的全部列,各个列之间用逗号连接,列头显示成OUT_PUT

    SELECT 
        IFNULL(commission_pct,0) AS 奖金率,
        commission_pct
    FROM 
        employees;
    

    SELECT
        CONCAT(`first_name`,',',`last_name`,',',`job_id`,',',IFNULL(commission_pct,0)) AS out_put
    FROM
        employees;
    

    相关文章

      网友评论

          本文标题:MySQL Demo 01

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