- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4219 Articles for MySQLi
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
462 Views
You can stop rounding decimal field with the help of DECIMAL() function. Here is the demo of a rounded decimal field. For our example, let us first create a demo tablemysql> create table stopRoundingDemo -> ( -> Amount DECIMAL(7) -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into stopRoundingDemo values(7836.783); Query OK, 1 row affected, 1 warning (0.43 sec) mysql> insert into stopRoundingDemo values(1737.67); Query OK, 1 row affected, 1 warning (0.23 sec) mysql> insert into stopRoundingDemo values(110.50); Query OK, 1 ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
962 Views
You can use CONCAT() function to set date and time fields to get DATETIME field.Let us create a demo tablemysql> create table getDateTimeFieldsDemo -> ( -> ShippingDate date, -> ShippingTime time, -> Shippingdatetime datetime -> ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2018-01-21', '09:45:34'); Query OK, 1 row affected (0.16 sec) mysql> insert into getDateTimeFieldsDemo(ShippingDate, ShippingTime) values('2013-07-26', '13:21:20'); Query OK, 1 row affected (0.13 sec) mysql> ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
To add/ concatenate text values within a select clause, you can use concat() function.Let us create a tablemysql> create table ConcatenatingDemo -> ( -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserName varchar(20), -> UserCountryName varchar(20) -> ); Query OK, 0 rows affected (0.82 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into ConcatenatingDemo(UserName, UserCountryName) values('John', 'US'); Query OK, 1 row affected (0.14 sec) mysql> insert into ConcatenatingDemo(UserName, UserCountryName) values('Carol', 'UK'); Query OK, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
90 Views
You can use COUNT() function for this. Let us first create a demo tablemysql> create table countValueDemo -> ( -> ShippingDatetime datetime, -> FirstValue int, -> SecondValue int -> ); Query OK, 0 rows affected (1.35 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into countValueDemo values('2019-01-23', 1, 2); Query OK, 1 row affected (0.24 sec) mysql> insert into countValueDemo values('2017-02-21', NULL, 2); Query OK, 1 row affected (0.13 sec) mysql> insert into countValueDemo values('2016-04-12', 1, NULL); ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
90 Views
You can speed the MySQL insert when you are inserting multiple records at the same time with the help of the following syntaxSTART TRANSACTION insert into insertDemo(yourColumnName1, yourColumnName2, ...N) values(yourValue1, yourValue2, ....N), (yourValue1, yourValue2, ....N), .......N commitLet us first create a demo tablemysql> create table insertDemo -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentAge int -> ); Query OK, 0 rows affected (0.72 sec)Insert multiple records at the same time. The query is as follows −mysql> START TRANSACTION; Query OK, 0 rows affected (0.00 sec) mysql> insert into ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
233 Views
Let us first create a demo tablemysql> create table excludeCertainColumnsDemo -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(100), -> StudentAge int, -> StudentMarks int, -> StudentAddress varchar(200) -> ); Query OK, 0 rows affected (0.50 sec)Now you can check the description of table with the help of desc command. The query is as follows −mysql> desc excludeCertainColumnsDemo;The following is the output+----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+----------------+ | ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
527 Views
To achieve this, the following is the syntaxselect date_format(from_unixtime(yourColumnName), '%b %d, %Y %l:%i %p PDT') from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table unixTimeStampFormatDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> MyTimeStampValue bigint -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into unixTimeStampFormatDemo(MyTimeStampValue) values(1334428200); Query OK, 1 row affected (0.20 sec) mysql> insert into unixTimeStampFormatDemo(MyTimeStampValue) values(1513881000); Query OK, 1 row affected (0.15 ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
70 Views
Let us first create a tablemysql> create table orderByAFunctionDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstNumber int, -> SecodNumber int -> ); Query OK, 0 rows affected (0.44 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(10, 4); Query OK, 1 row affected (0.11 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(45, 78); Query OK, 1 row affected (0.17 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(23, 10); Query OK, 1 row affected (0.12 sec) mysql> insert into orderByAFunctionDemo(FirstNumber, SecodNumber) values(67, ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
1K+ Views
To display sum in last row of a table, you can use UNION. To understand how, let us create a tablemysql> create table showSumInLastRowDemo -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentMarks int -> ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into showSumInLastRowDemo(StudentName, StudentMarks) values('John', 56); Query OK, 1 row affected (0.14 sec) mysql> insert into showSumInLastRowDemo(StudentName, StudentMarks) values('John', 87); Query OK, 1 row affected (0.10 sec) mysql> insert into showSumInLastRowDemo(StudentName, StudentMarks) ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
902 Views
To compare two strings which are numbers in MySQL, use the CAST() function.The syntax is as followsselect *from yourTableName where cast(yourColumnName as signed)=yourIntegerValue;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table compareTwoStringDemo -> ( -> UserId varchar(100) -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into compareTwoStringDemo values('1083745'); Query OK, 1 row affected (0.12 sec) mysql> insert into compareTwoStringDemo values('9867585'); Query OK, 1 ... Read More