- 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
1K+ Views
Let us first create a table −mysql> create table DemoTable ( Value varchar(100) ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('€986'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('§97'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------+ | Value | +--------+ | €986 | | §97 +--------+ 2 rows in set (0.00 sec)Following is the query to remove unconvertable characters to ASCII ... Read More
450 Views
To select distinct values from two columns, use UNION. Let us first create a table −mysql> create table DemoTable1 ( Value1 int ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(1); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1 values(2); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1 values(3); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1 values(4); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will ... Read More
77 Views
Let us first create a table −mysql> create table DemoTable ( StudentId int, StudentName varchar(100) ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(NULL, 'Chris'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(NULL, 'Robert'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(101, 'David'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(102, 'Mike'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(103, 'Sam'); Query OK, 1 row affected (0.18 sec)Display all records ... Read More
442 Views
Let us first create a table −mysql> create table DemoTable ( Value varchar(100) ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('190'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('230'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('120'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('189'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+-------+ | Value | +-------+ ... Read More
52 Views
Let us first create a table −mysql> create table DemoTable ( DueDate varchar(100) ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('21/10/2018'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable values('18/08/2019'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('01/12/2012'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('31/01/2016'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+------------+ | DueDate ... Read More
891 Views
Let us first create a table −mysql> create table DemoTable1 ( PersonId int, Value int ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(100, 78); Query OK, 1 row affected (0.46 sec) mysql> insert into DemoTable1 values(101, 67); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1 values(102, 89); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output −+----------+-------+ | PersonId | Value | +----------+-------+ | 100 ... Read More
85 Views
Let us first create a table −mysql> create table DemoTable ( FirstName varchar(100), CountryName varchar(100) ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Adam', 'US'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('David', 'AUS'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Chris', 'UK'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('John', 'US'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('Carol', 'AUS'); Query OK, 1 row affected (0.14 sec)Display all records ... Read More
917 Views
Here’s the syntax to check whether the table already exists using the CREATE TABLE IF NOT EXISTS −create table if not exists yourTableName ( yourColumnName1 dataType, . . . . N ); insert into yourTableName values(yourValue1, .......N);Let us first create a table −mysql> create table if not exists DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentSubject varchar(100) ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentSubject) values('Java'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable(StudentSubject) values('MySQL'); ... Read More
97 Views
For this, you can use FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Value varchar(100) ); Query OK, 0 rows affected (2.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value) values('100;200;300'); Query OK, 1 row affected (0.42 sec) mysql> insert into DemoTable(Value) values('1;300;400'); Query OK, 1 row affected (0.58 sec) mysql> insert into DemoTable(Value) values('6;7;8;9;10'); Query OK, 1 row affected (0.29 sec) mysql> insert into DemoTable(Value) values('1;2;3;4;5'); Query OK, 1 row affected (9.36 sec) mysql> insert into DemoTable(Value) values('3;8;9;10'); Query OK, 1 ... Read More
1K+ Views
Let us first create a table &mnus;mysql> create table DemoTable ( `timestamp` timestamp ); Query OK, 0 rows affected (1.12 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(now()); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values('00:00:00'); Query OK, 1 row affected (0.73 sec) mysql> insert into DemoTable values('2018-01-10 12:34:45'); Query OK, 1 row affected (0.80 sec) mysql> insert into DemoTable values('2019-12-31 10:50:45'); Query OK, 1 row affected (0.84 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+---------------------+ | timestamp ... Read More