INSERT INTO public."Students"("StudentID","StudentName","StudentBirthday","StudentAddress","StudentSalary") VALUES ('4','贾雨村','1688-8-8','江苏省江宁府','1'),('5','贾代化','1677-8-8','辽宁省','1');
先查看数据插入后查询结果。
下面练习指定值删除数据。
#删除StudentID为4 行 DELETE FROM public."Students" WHERE "StudentID"=4; #删除查询结果 #DELETE 1 #Query returned successfully in 148 msec.
下面继续演示批量删除数据。
#批量删除多行数据 DELETE FROM public."Students" USING (VALUES (3),(5)) AS testtemp(studentid) WHERE "StudentID"= testtemp.studentid; #DELETE 2 #Query returned successfully in 153 msec.
清空表可以
#温馨提示:黄金有价数据无价请谨慎操作 TRUNCATE TABLE public."Students"; #TRUNCATE TABLE #Query returned successfully in 219 msec. #清空表Students,无提示 DELETE FROM public."Students";
警告:清空表操作为不可逆操作,操作前请注意备份数据或检查确认数据库信息!
原文链接:https://www.f2er.com/postgresql/193522.html