Add operation:
$ Model = newUser ();
$ Model-> username = 'username ';
$ Model-> age = '20 ';
$ Model-> insert ();
Query operation:
User: find ()-> all (); this method returns all data;
User: findOne ($ id); this method returns a data entry with primary key id = 1;
User: find ()-> where (['name' => 'username'])-> one (); this method returns a piece of data from ['name' => 'username;
User: find ()-> where (['name' => 'username'])-> all (); this method returns all data of ['name' => 'username;
User: findBySql ('select * FROM user')-> all (); this method uses SQL statements to query all data in the user table;
User: findBySql ('select * FROM user')-> one (); this method uses an SQL statement to query a piece of data in the user table;
User: find ()-> andWhere (['Sex '=> 'mal', 'age' => '24'])-> count ('id '); count the total number of eligible items;
User: find ()-> one (); this method returns a piece of data;
User: find ()-> all (); this method returns all data;
User: find ()-> count (); the number of records returned by this method;
User: find ()-> average (); this method returns the average value of the specified column;
User: find ()-> min (); this method returns the minimum value of the specified column;
User: find ()-> max (); this method returns the maximum value of the specified column;
User: find ()-> scalar (); query results in the first column of the first row returned by this method;
User: find ()-> column (); this method returns the value of the first column in the query result;
User: find ()-> exists (); this method returns a value indicating whether the data row contains the query result;
User: find ()-> batch (10); obtain 10 data records each time.
User: find ()-> each (10); obtain 10 pieces of data each time for iterative query
Delete operation:
User: deleteAll ('name = username'); delete data with name = username;
User: findOne ($ id)-> delete (); delete a database whose primary key is the $ id variable value;
User: deleteAll ('Age>: age AND sex =: sex ', [': age' => '20', ': sex' => '1']); delete qualified data;