24_MySQL插入insert语句
本节涉及SQL语句:
-- MYSQL 基础操作 1.插入insert语句 INSERT INTO t_dept(deptno,dname,loc) VALUES(70,"后勤部","北京"),(80,"保安部","北京"); 2.向技术部插入一条员工信息 INSERT INTO t_emp (empno,ename,job,mgr,hiredate,sal,comm,deptno) VALUES(8001,"刘娜","SALESMAN",8000,"1988-12-20",2000,NULL,(SELECT deptno FROM t_dept WHERE dname="技术部"));
写入多条数据
练习
-- INSERT 语句方言 INSERT t_emp SET empno=8002,ename="王谦",job="python",mgr=8000,hiredate="1985-01-01",sal=2500,comm=NULL,deptno=50;
-- IGNORE INSERT IGNORE INTO t_dept (deptno,dname,loc) VALUES(70,"A","北京"),(90,"B","上海");