一、ORM简介

  • MVC或者MVC框架中包括一个重要的部分,就是ORM,它实现了数据模型与数据库的解耦,即数据模型的设计不需要依赖于特定的数据库,通过简单的配置就可以轻松更换数据库,这极大的减轻了开发人员的工作量,不需要面对因数据库变更而导致的无效劳动
  • ORM是“对象-关系-映射”的简称。

Django - 模型层 - 上

 

create table employee(
    id int primary key auto_increment,
    name varchar(20),
    gender bit default 1,
    birthday date,
    department varchar(20),
    salary decimal(8,2) unsigned
);

insert into employee (
    name,gender,birthday,salary,department
) values(
    'alex',1,'1985-12-12 ',8000,'开发部'
);
select * from employee where name = 'alex';

update employee set birthday = '1989-1-1' where id = 1;

delete from employee where name = 'alex';

drop table employee;
sql

相关文章:

  • 2021-09-29
  • 2021-05-24
  • 2021-07-01
  • 2021-05-17
  • 2022-03-01
  • 2022-01-18
  • 2022-12-23
猜你喜欢
  • 2022-01-14
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案