笔记

插入一条数据

INSERT INTO 表名 (字段,字段) VALUES (值,值);

插入多条数据

INSERT INTO 表名 (字段,字段) VALUES (值,值), (值,值)

(SELECT
    a.id,
    a.NAME,
    a.`password`,
    b.NAME AS typename 
FROM
    y_users a
    INNER JOIN y_type b ON a.typeid = b.id 
ORDER BY
    a.id ASC) 
    UNION ALL
(SELECT
    a.id,
    a.NAME,
    a.`password`,
    b.NAME AS typename 
FROM
    y_users a
    INNER JOIN y_type b ON a.typeid = b.id 
ORDER BY
    a.id ASC)
    SELECT
    a.id,
    a.NAME,
    a.`password`,
    b.NAME AS typename 
FROM
    y_users a
    INNER JOIN y_type b ON a.typeid = b.id 
ORDER BY
    a.id ASC limit 0,2

你可能感兴趣的:(笔记)