- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHPPhysics
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 10744 Articles
AmitDiwan
783 Views
Let us first create a table −mysql> create table DemoTable1219 ( Id int, Name varchar(40) ); Query OK, 0 rows affected (0.43 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1219 values(100, 'Adam'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1219 ... Read More
AmitDiwan
287 Views
The incremented value can be set in a user-defined variable as shown below. Here, “yourValue” is the incremented value. After that, use MySQL UPDATE to update the column and increment timestamp values −set @anyVariableName :=yourValue; update yourTableName set yourColumnName=yourColumnName+interval (@yourVariableName) second;Let us first create a table −mysql> create table DemoTable ... Read More
AmitDiwan
169 Views
To count items, use COUNT() along with DISTINCT. Here, DISTINCT is used to return distinct values. Let us now see an example and create a table −mysql> create table DemoTable ( CustomerId int, CustomerName varchar(20), ProductName varchar(40) ); Query OK, 0 rows affected (1.02 sec)Insert some records ... Read More
AmitDiwan
278 Views
SELECT is by default case-insensitive. For case-sensitive implementation, the BINARY operator is used. Following is the syntax :select *from yourTableName where BINARY yourColumnName=yourValue;Let us first create a table −mysql> create table DemoTable ( Name varchar(40) ); Query OK, 0 rows affected (0.74 sec)Insert some records in the table using ... Read More
AmitDiwan
131 Views
To ORDER BY grouped fields, use ORDER BY CASE along with IN(). CASE evaluates different conditions whereas ORDER BY sort values in ascending or descending order. The MySQL IN() is used to find a match.Let us first create a table −mysql> create table DemoTable ( Value varchar(40) ); Query ... Read More
AmitDiwan
376 Views
Use SELECT 1 for this as in the below syntax −select 1 from yourTableName where yourColumnName=yourValue;If the above returns 1, that means value exists in the MySQL database. Let us first see an example and create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY ... Read More
AmitDiwan
191 Views
Let us first create a table −mysql> create table DemoTable ( FirstName varchar(20) ); Query OK, 0 rows affected (1.15 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(NULL); Query OK, 1 ... Read More
AmitDiwan
458 Views
Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(40), StudentMathMarks int, StudentMySQLMarks int, status ENUM('ACTIVE', 'INACTIVE') ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert ... Read More
AmitDiwan
4K+ Views
The only difference between BIGINT and BIGINT(20) is for displaying width. The 20 can be used for displaying width.Let us see an example and create a table. Here, we have set BIGINT(20) −mysql> create table DemoTable ( Number bigint(20) zerofill ); Query OK, 0 rows affected (0.58 sec)Insert some ... Read More
AmitDiwan
204 Views
Let us first create a table −mysql> create table DemoTable ( Name varchar(40) ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Sam'); Query OK, 1 ... Read More