MySQL 數據庫
存儲數據的方式
. 靠大腦
. 寫在紙上
. 寫在計算機內存中
. 寫在磁盤文件中
數據庫能做什么?
存儲大量的數據,方便檢索。
保持數據信息一致,完整
共享和安全
同過組合分析,產生新的有用信息。
MySQL常見的操做命令:
-- 根據年齡查詢數據 where 代表條件 后面添加條件語句
select * from student where age=10
select * from student where name='zhangsan'
-- 插入數據
insert into 表名 values 列屬性
insert into student values ( 4, 'qq', 13, 'w' )
insert into student (id, name) values ( 5, 'qw')
-- 刪除表中所有的數據
delete from student
-- 刪除表中滿足條件的數據
delete from student where name='zhangsan'
--將一個表中的數據復制到另外一個表中
-- 將student中所有的數據復制到t1中
INSERT INTO newadmin SELECT * FROM admin;
-- 修改表中的內容
update student set name ='aaa'
update student set name = 'aaa' where age=11
--新建表結構
create table student (
id integer primary key,
name varchar(20),
age integer(2),
sex char(1)
)
-- 刪除表結構
drop table student