DB Of the class Inquire about :
- All acquisition that meets the conditions :DB::table(" Table name ")->where("name",">","1")->get();
- The first column that satisfies the condition gets :DB::table(" Table name ")->where("name",">","1")->first();
- All fields that meet the criteria :DB::table(" Table name ")->where("name",">","1")->lists("title");
- A single field that satisfies the condition :DB::table(" Table name ")->where("name",">","1")->pluck("title");// Returns an array of binary field values
DB::table(" Table name ")->where("name",">","1")->pluck("title","name");// Returns an array of binary field values The second parameter specifies key - Block query data column :DB::table(" Table name ")->chunk(100,function($users){
//$users to do $user yes table in 2 Row the result of a query
//return false; Stop processing the next data
}) - Specify query sentence :DB::table(" Table name ")->select("name","email")->get();
- Add a query clause to an existing query :$query=DB::table(" Table name ")->select("name","email");$query->addSelect("age")->get();
- Conditions of the query where and orWhere:DB::table(" Table name ")->where("name",">","10")->orWhere("titile","=","0")->get();
- Conditions of the query whereBetween and whereNotBetween:DB::table(" Table name ")->where("name",">","10")->whereBetween("titile","=","[0,10]")->get();
- Conditions of the query whereIn:DB::table(" Table name ")->where("name",">","10")->whereIn("titile","[1,2,3]")->get();
- Conditions of the query whereNull:DB::table(" Table name ")->where("name",">","10")->whereNull("titile")->get();// Unconfigured values
- Conditions of the query where Clauses:DB::table(" Table name ")->where("name",">","10")->whereNameAndTitle("name",titile")->get();
- Sort (Drder By), Group (Group By) And Having:
$users=DB::table("users")->orderBy("name","desc")->groupBy("count")->having("count",">",100)->get()
The offset (Offset) And Limit (Limit)
$users=DB::table("users")->skip(10)->take(5)->get();
PHP——laravel And DB class -> For more related articles
- laravel5.1 frame model Class query implementation
laravel frame model Class query implementation : User::where(['uid'=8])->get(); User Class inherits from Model class :Illuminate\Database\Eloquent\M ...
- Laravel5.2 in Eloquent And DB What's the difference between classes ?
Let's look at these components first ( Namely Eloquent ORM) The database component is divided into three layers : Database connection layer Query construction layer application layer Take a look at what's on each floor , Corresponding to which part of the document : Database connection layer ...
- Encapsulate your own DB class (PHP)
Encapsulates a DB class , It is used to operate the database , After the general operation of the database , All by DB Class . So I have my own DB class , When writing a project, it's easy sql You don't have to write every time , Call directly , Very convenient ! 1. Encapsulates a DB class . A class file ...
- nodejs operation mongodb Encapsulating the database DB class
This DB Class is also my experience 3 It's a practical project , Now share it , If necessary, please refer to the criticism . The notes above are very detailed , I used nodejs Plug in for mongoose, use mongoose operation mongodb Actually, it's quite convenient . Turn off ...
- How to go from SharePoint Content DB Query in List data
SharePoint It's very convenient to maintain basic data , Just create a custom list , And then use InfoPath Customize the maintenance interface , You can add, delete, modify and search online , Development efficiency is very high . If the maintained data needs to be approved , You can also add workflow functions ...
- encapsulation DB class
encapsulation DB class Generally, a class is written separately in a Php In file , In order to see the name and know the meaning , There will be a specification for file names : Class name .class.php The first 1 Step : establish DB class The first 2 Step : Attribute design The first 3 Step : first ...
- Jfinal in Db Use of class
Jfinal It provides two kinds of components to operate the database , Namely Model Classes and DB class , Can greatly reduce the amount of code , Improve development efficiency . Db Class provides the Model Rich database operation ability beyond class , Use Db Class and nested Record Class time , ...
- TP5 Model classes and Db The differences in the use of classes
original text :http://www.upwqy.com/details/3.html summary In the controller Model operation get() and all() Can only be used alone to query data Want chain operation to query data Need to use f ...
- nodejs mongodb Encapsulating the database DB class - turn
Using the nodejs Plug in for mongoose, use mongoose operation mongodb Actually, it's quite convenient . About mongoose The installation is npm install -g mongoose This DB The database configuration of class is ...
Random recommendation
- Chat SOA Service Oriented Architecture
What is? SOA SOA(Service-Oriented Architecture), Service oriented architecture .SOA It's a coarse grain . Loosely coupled Service Architecture , Between services through simple . Precisely define the interface for communication , It does not involve the underlying programming interface and communication ...
- VS Solution manager and Edit window synchronization linkage
The explanation for the title is When I click on... In solution manager A document , The editing window will be linked Synchronize to the corresponding window . It seems that I turned it off by accident before , Today, I rebuilt a project and found out how to set it up If you want to click on the document on the right ...
- JSP+Servlet Use in cos.jar Upload pictures ( The same goes for file uploads )
link :JSP+Servlet Use in jspsmartupload.jar Upload and download pictures About cos.jar, Baidu Encyclopedia has only a few words (http://baike.baidu.com/subview/406 ...
- H5- Examination judgment questions
1. All elements can be set width and height after floating . 2. Line elements can't set width, height, top and bottom margins 3. be-all css In style priority “!important” The highest priority ( It is not recommended to use ) 4. Changing the elements transition value , ...
- MyBatis Entity class mapping file template
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC " ...
- socket Write simple echo server
socket It is widely used in company code , For example, interface calls IPCRPC Mechanism , I often see code like this , But I haven't written it yet . Create a subprocess in a larger process , Because parent-child process replication wastes memory , You can use the command to create the process to ...
- Take you in EJB-- Those with EJB Container related ones Java Concept
I've been right recently EJB Summarize the related content of , In the process of summing up, I found that I didn't understand the concept of container very well , because EJB It's a container , But what are containers for ? It's similar to the components we've seen before , frame , package , Class and so on ? The next main thing is ...
- Group programming ladder competition - Exercise set L2-010. Row of seats
L2-010. Row of seats The time limit 150 ms Memory limit 65536 kB Code length limit 8000 B The procedure of judging questions Standard author Chen Yue The most delicate thing is to set up a banquet , It is to arrange seats for the guests who come to the banquet . ...
- Usage、Usage Minimum and Usage Maximum Project details
(1) One generates multiple data fields (Report Count>1) There is more than one before the main project of [ purpose ] when , Every [ purpose ] Corresponding to a data field in turn , If the number of data fields (Report Count) exceed [ purpose ] The number of , Then the surplus ...
- What a good designer should know 20 Big UI Design principles
World class graphic designer Paul Rand( Paul . rand ) Once said :" Design is by no means simple permutation and re editing , It should be full of value and meaning , To make sense , Cut out the complexity and make it simple , To clarify and deduce , To beautify , To praise , Make it ...