- 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
AmitDiwan has Published 11365 Articles
AmitDiwan
297 Views
Yes, we can do that. Let us first create a table −mysql> create table DemoTable( Id int ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(201); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable ... Read More
AmitDiwan
1K+ Views
The @@identity returns the last inserted value in the auto_increment column in the current session. Let us first create a table −mysql> create table DemoTable( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserName varchar(100) ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using ... Read More
AmitDiwan
137 Views
Let us first create a table −mysql> create table DemoTable( ProductName varchar(100), ProductPrice int ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Product-1', 56); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Product-2', ... Read More
AmitDiwan
365 Views
If you will extend the size of a varchar field in MySQL then it won’t affect the data inside it.Let us first create a table −mysql> create table DemoTable( Name varchar(8) ); Query OK, 0 rows affected (1.11 sec)Insert some records in the table using insert command −mysql> insert ... Read More
AmitDiwan
55 Views
Let us first create a table −mysql> create table DemoTable( FirstName varchar(100) ); Query OK, 0 rows affected (0.97 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row ... Read More
AmitDiwan
105 Views
For this, you can use a PREPARE statement. Let us first create a table −mysql> create table DemoTable( FirstName varchar(100), CountryName varchar(100) ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Adam', 'US'); Query OK, 1 row ... Read More
AmitDiwan
85 Views
For this, use the GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable( Name varchar(100), Age int ); Query OK, 0 rows affected (1.50 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 23); Query OK, 1 row ... Read More
AmitDiwan
99 Views
For this, you need to use IN() and after that FIELD() method. Let us first create a table −mysql> create table DemoTable( StudentId varchar(10), StudentName varchar(20) ) ; Query OK, 0 rows affected (4.11 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('10001', ... Read More
AmitDiwan
1K+ Views
For exact string, you need to use wildcard ‘%’ with LIKE operator −select *from yourTableName where binary yourColumnName LIKE '%yourStringValue%';Let us first create a table −mysql> create table DemoTable( Name varchar(20) ); Query OK, 0 rows affected (1.93 sec)Insert some records in the table using insert command −mysql> insert ... Read More
AmitDiwan
405 Views
Let us first create a table −mysql> create table DemoTable( Value int ); Query OK, 0 rows affected (1.35 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values(NULL); Query OK, 1 row ... Read More