Home
Add Document
Sign In
Register
laptrinhlaravel_bai12.pdf
Home
laptrinhlaravel_bai12.pdf
Full description...
Author:
Ho Khoa
14 downloads
138 Views
199KB Size
Report
DOWNLOAD .PDF
Recommend Documents
No documents
BÀI 12 : QUERY BUILDER I Select All $cate = DB::table('category')->get();
II Select Column $cate = DB::table('category')->select('name')->get();
III Select Where $cate = DB::table('category')->where('id',5)->get();
IV Select Where Or Where $cate = DB::table('class')->where('age',40) ->orWhere('scholl','A') ->get();
V Select Order By $cate = DB::table('category')->orderBy('id','DESC')->get();
VI Select Offset & Limit $cate = DB::table('category')->skip(3)->take(2)->get();
VII Select Where Between $cate = DB::table('category')->whereBetween('id',[1,2])->get();
VIII Select Where Not Between $cate = DB::table('category')->whereNotBetween('id',[1,2])->get();
IX Select Where In $cate = DB::table('category')->whereIn('id',[1,2])->get();
X Select Where Not In $cate = DB::table('category')->whereNotIn('id',[1,2])->get();
XI Select Where Null $cate = DB::table('category')->whereNull('sodienthoai')->get();
XII Count Row $cate = DB::table('category')->count();
XIII Max Row $cate = DB::table('product')->max('price');
XIV Min Row $cate = DB::table('product')->min('price');
XV AVG Row $cate = DB::table('product')->avg('price');
XVI Total Row $cate = DB::table('product')->sum('price');
XVII Joins $product = DB::table('product')->join('category','category.id','=','product.cate_id')->get();
Lưu ý : chỉ có thể sử dụng khi không có khóa ngoại XVIII Insert DB::table('product')->insert(
['name' => 'Giày Thể Thao', 'price'=>50000, 'cate_id'=>5] );
XIX Insert And Get Id $id = DB::table('category')->insertGetId(
['name' => 'Giày'] ); echo $id;
XX Update DB::table('category')->where('id', 1) ->update(['name' => "Áo Gió"]);
XXI Delete DB::table('product')->where('id', 1) ->delete();
XXII Delete All Record DB::table('product')->delete();
×
Report "laptrinhlaravel_bai12.pdf"
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
×
Sign In
Email
Password
Remember me
Forgot password?
Sign In
Our partners will collect data and use cookies for ad personalization and measurement.
Learn how we and our ad partner Google, collect and use data
.
Agree & close