sqlite 基本知识与使用
字段:
记录:
外键:别的表的主键
主键:唯一标识一条记录,不能有重复值
create table Student(ID integer primary key,name text,sex text,age text,hobby text,t_id integer)
注:create[创建] tabel[表格]Student[表格名称](ID integer primary key,)
// 添加数据的语法
insert into Student(name,sex,age,hobby,t_id)
values('jobs','男','26','Apple','1')
// 更新数据的语法
update Student set hobby = '慈善' where ID = 2
// 删除数据
delete from Student where ID = 2
//查询语句
select * from Student
select name,age from Student
//查询学号为1的学生的姓名
select name from Student where ID = 1
//模糊查找
select name from Student where name like '%C%'('C%'、‘%C’)
//查询我表中有多少行数据?
select count(*) from Student
//别名
select count(ID) as count from Student
//--多表查询--
//创建多一个叫Teacher表
create table Teacher(ID integer primary key,name text)
insert into Teacher(name)
values('tt')
//多表查询
select Student.name,Teacher.name
from Student,Teacher
where Student.t_id = Teacher.ID and Student.ID = 1
//什么是事务
Join On
sqlite 的数据类型包括:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!