- 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
158 Views
Let us first create a table −mysql> create table DemoTable676( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Number int ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable676(Number) values(1000); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable676(Number) values(1839); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable676(Number) values(29894); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable676(Number) values(1264); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable676(Number) values(190); Query OK, 1 row affected (0.17 sec) mysql> insert into ... Read More
378 Views
To search within a table of comma-separated values, use LIKE operator. Let us first create a table −mysql> create table DemoTable675(Value text); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable675 values('10, 56, 49484, 93993, 211, 4594'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable675 values('4, 7, 1, 10, 90, 23'); Query OK, 1 row affected (0.41 sec) mysql> insert into DemoTable675 values('90, 854, 56, 89, 10'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable675 values('11, 22, 344, 67, 89'); Query OK, 1 row ... Read More
61 Views
Yes, we can name columns in an insert statement. Let us first create a table −mysql> create table DemoTable674( StudentId int, StudentFirstName varchar(100), StudentLastName varchar(100) ); Query OK, 0 rows affected (0.82 sec)Insert some records in the table using insert command −mysql> insert into DemoTable674 set StudentId=10, StudentFirstName='John', StudentLastName='Smith'; Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable674 set StudentId=11, StudentFirstName='Carol', StudentLastName='Taylor'; Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable674 set StudentId=12, StudentFirstName='David', StudentLastName='Miller'; Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable674 set StudentId=13, StudentFirstName='Chris', StudentLastName='Brown'; Query OK, 1 ... Read More
1K+ Views
For this, use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable673( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Value int ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable673(Value) values(10); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable673(Value) values(20); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable673(Value) values(10); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable673(Value) values(30); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable673(Value) values(20); Query OK, 1 ... Read More
227 Views
For this, use order by nullif(). Let us first create a table −mysql> create table DemoTable672( CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY, CustomerName varchar(100), CustomerAmount int ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command −mysql> insert into DemoTable672(CustomerName, CustomerAmount) values('Chris', 560); Query OK, 1 row affected (0.51 sec) mysql> insert into DemoTable672(CustomerName, CustomerAmount) values('Robert', null); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable672(CustomerName, CustomerAmount) values('', 450); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable672(CustomerName, CustomerAmount) values('David', 456); Query OK, 1 row affected ... Read More
77 Views
For particular type of columns beginning with a certain letter, use LIKE. To concatenate the column names, use GROUP_CONCAT() as in the below syntax −SELECT group_concat(COLUMN_NAME separator ' , ') FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = "yourTableName" AND table_schema = "yourDatabaseName" AND column_name LIKE "yourSpecificLetter%";Let us first create a table −mysql> create table DemoTable671( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(100), ClientAge int, ClientAddress varchar(200), ClientCountryName varchar(100) ); Query OK, 0 rows affected (0.62 sec)Following is the query to select particular type of columns beginning with a certain letter and fetch all the column ... Read More
90 Views
To sort domain names, use the ORDER BY SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable670(DomainName text); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command. Here, we are inserting domain names −mysql> insert into DemoTable670 values('www.facebook.com'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable670 values('www.google.com'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable670 values('www.amazon.com'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable670;This will produce the following output −+------------------+ | DomainName ... Read More
114 Views
For this, use ORDER BY ISNULL(). Let us first create a table −mysql> create table DemoTable669 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentScore int ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable669(StudentScore) values(45) ; Query OK, 1 row affected (0.80 sec) mysql> insert into DemoTable669(StudentScore) values(null); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable669(StudentScore) values(89); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable669(StudentScore) values(null); Query OK, 1 row affected (0.15 sec)Display all records from the table using select ... Read More
2K+ Views
Let us first create a table −mysql> create table DemoTable668(JoiningDate varchar(200)); Query OK, 0 rows affected (0.97 sec)Insert some records in the table using insert command. We have inserted date in the format yyyy-mm-ddThh:mm:ss.sssZ −mysql> insert into DemoTable668 values('2001-01-10T06:20:00.000Z'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable668 values('2019-07-20T04:00:00.000Z'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable668 values('2016-02-12T05:10:50.000Z'); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select *from DemoTable668;This will produce the following output −+--------------------------+ | JoiningDate | +--------------------------+ | ... Read More
1K+ Views
Let’s say the current date is 2019-07-25. We will now see an example and create a table where ShippingDate is added in the table.Let us first create a table −mysql> create table DemoTable667(ShippingDate datetime); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable667 values('2019-01-31'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable667 values('2019-07-19'); Query OK, 1 row affected (0.69 sec) mysql> insert into DemoTable667 values('2019-07-23'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable667 values('2019-08-24'); Query OK, 1 row affected (0.15 sec)Display all records from ... Read More