
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
7K+ Views
To encrypt and decrypt in MySQL, use the AES_ENCRYPT() and AES_DECRYPT() in MySQL −insert into yourTableName values(AES_ENCRYPT(yourValue, yourSecretKey)); select cast(AES_DECRYPT(yourColumnName, yourSecretKey) as char) from yourTableName;To understand the above syntax, let us first create a table −mysql> create table demo63 −> ( −> value blob −> ); Query OK, 0 ... Read More

AmitDiwan
213 Views
For this, use INSERT INTO SELECT statement in MySQL. Let us create a table −mysql> create table demo61 −> ( −> id int, −> name varchar(20) −> ) −> ; Query OK, 0 rows affected (1.84 sec)Insert some records into the table with the help of insert command −mysql> insert ... Read More

AmitDiwan
527 Views
Following is the syntax −select yourColumnName1, yourColumnName2, yourColumnName3, . . . N from yourTableName where yourValue in(yourColumnName1, yourColumnName2) or yourColumnName1 is NULL;Let us create a table −mysql> create table demo60 −> ( −> id int not null auto_increment primary key, −> first_name varchar(20), −> last_name varchar(20) −> ) −> ; ... Read More

AmitDiwan
203 Views
To store the exact real value, you need to use truncate() with 2 decimal point. Let us create a table −Following is the query to create a table.mysql> create table demo59 −> ( −> price decimal(19, 2) −> ); Query OK, 0 rows affected (1.12 sec)Insert some records into the ... Read More

AmitDiwan
284 Views
Fir this, use CASE WHEN statement in MySQL correctly. Let us see how.Let us create a table −mysql> create table demo58 −> ( −> id int not null auto_increment primary key, −> first_name varchar(20), −> last_name varchar(20) −> ); Query OK, 0 rows affected (2.15 sec)Insert some records into the ... Read More

AmitDiwan
136 Views
For this, you can use ORDER BY. Let us create a table −mysql> create table demo57 −> ( −> id int not null auto_increment primary key, −> full_name varchar(20) −> ); Query OK, 0 rows affected (1.60 sec)Insert some records into the table with the help of insert command −mysql> ... Read More

AmitDiwan
823 Views
Following is the syntax −insert into yourTableName values(yourValue1, yourValue2, .....N), (yourValue1, yourValue2, .....N), (yourValue1, yourValue2, .....N), (yourValue1, yourValue2, .....N), . . . NLet us create a table −mysql> create table demo56 −> ( −> id int, −> first_name varchar(20), −> last_name varchar(20), −> age int −> ); Query OK, 0 ... Read More

AmitDiwan
1K+ Views
For this, you can use UPDATE command along with JOIN.Let us create the first table −mysql> create table demo54 −> ( −> firstName varchar(20), −> lastName varchar(20) −> ); Query OK, 0 rows affected (0.57 sec)Insert some records into the table with the help of insert command −mysql> insert into ... Read More

AmitDiwan
2K+ Views
To push values into an associative array, use the brackets [] []. At first create an associative array −$details= array ( 'id' => '101', 'name' => 'John Smith', 'countryName' => 'US' );The PHP code is as follows to insert values −Example Live Demo OutputArray ( [studentDetails] => Array ( [0] => Array ( [id] => 101 [name] => John Smith [countryName] => US ) ) )

AmitDiwan
846 Views
Let’s say the following is our string including hyphen and numbers as well −"John-45-98-78-7898906756"To extract numbers after – i.e. hyphen, use the concept of explode() with parameters - and $yourVariableName.The PHP code is as follows −Example Live Demo Output7898906756