1.添加数据
DB::table("users")->insert($data);
2.单条查询
DB::table("users")->where('username','zhangsan')->first();
3.查询全部
DB::table("users")->select("username")->get();
4.删除
DB::table("users")->where("id",'=',$id)->delete();
5.修改
DB::table("users")->where("id",'=','2')->update($data);
6.join使用
DB::table("users")->join('uc', 'users.id', '=', 'uc.user_id')
->join('cl', 'cl.id', '=', 'uc.class_id')
->select("*")
->get();
7.偏移(offset)限制 (limit)DB::table("users")->skip(10)->take(5)->get();
8.order by 、group by、havingDB::table('users')
->orderBy('id', 'desc')
->groupBy('count')
->having('count', '>', 100)
->get();