mysqlのDML操作(一)
1147 ワード
本稿では,挿入,変更,削除の3つの面から具体的な操作を説明する(1)insert:データを挿入する順序でデータを挿入する
フィールド挿入データの指定
複数レコードの挿入
クエリー結果の挿入
(2)update:データの更新
(3)delete:データの削除
insert into values( 1, 2, 3);
フィールド挿入データの指定
insert into ( 1, 2, 3) values( 1, 2, 3);
複数レコードの挿入
insert into values( 1, 2, 3),( 1, 2, 3);
クエリー結果の挿入
insert into 1 select ( 1, n) from 2 where ;
mysql> insert into student values(1,'jack','m',20); \\
mysql> insert into student(name,age) values('bob',21); \\
mysql> insert into student values(6,'jex','m',21),(7,'bob1','f',22); \\
mysql> insert into student_his select * from student where name = 'robby'; \\
(2)update:データの更新
update set 1= 1, 2= 2 where ;
mysql> update mysql.user set authentication_string=password('redhat') where user='root' and host='localhost'; \\password()
mysql> flush privileges;
(3)delete:データの削除
delete from where ;
delete from ; //