
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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
162 Views
Let us first create a table −mysql> create table DemoTable -> ( -> DueDate date ->); Query OK, 0 rows affected (2.11 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-21'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable ... Read More

AmitDiwan
478 Views
Let us first create a table −mysql> create table DemoTable -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20) -> ); Query OK, 0 rows affected (1.07 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('Chris'); Query ... Read More

AmitDiwan
189 Views
For this, you can use the LEFT() function from MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(10) -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); ... Read More

AmitDiwan
340 Views
You cannot use “user” for a MySQL table because it is a reserved word in MySQL. You can change the name from user to users or something else or you can use backticks around the user word.The word user can be used to create a user or can select a ... Read More

AmitDiwan
242 Views
For this, you can use CURTIME(). Let us first create a table −mysql> create table DemoTable -> ( -> ArrivalTime timestamp -> ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-10-26 17:55:55'); Query OK, 1 ... Read More

AmitDiwan
2K+ Views
You can use the DECLARE command to declare a variable inside a MySQL procedure. Let us create a stored procedure in MySQL −mysql> DELIMITER // mysql> CREATE PROCEDURE DECLARE_VARIABLE_DEMO(IN value int) -> BEGIN -> DECLARE searchValue int; -> set searchValue=value; -> if searchValue=10 then -> ... Read More

AmitDiwan
2K+ Views
You need to close connection in finally block. Following is the Java code to close connection in JDBC and MySQL −import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class CloseConnectionDemoInFinallyBlock { public static void main(String[] args) { String JDBCURL = "jdbc:mysql://localhost:3306/web?useSSL=false"; Connection ... Read More

AmitDiwan
102 Views
For this, you can use NOT LIKE operator. Let us first create a table −mysql> create table DemoTable -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20), -> StudentAdmissionYear varchar(20) -> ); Query OK, 0 rows affected (1.22 sec)Insert some records ... Read More

AmitDiwan
554 Views
Let us first create a table −mysql> create table DemoTable -> -> ( -> StudentName varchar(20), -> StudentSubject varchar(20) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John', 'MySQL'); Query OK, 1 ... Read More

AmitDiwan
108 Views
For this, use LEFT in MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> Title text -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Java database connectivity to MySQL ... Read More