MySQL Query tricks

MySQL one the very famous Database. Today i going to share with you very simple tricks of MySQL. MySQL DB always come with WAMP, LAMP, XAMP and MySQL is easy because there are many supporters and old and newbie start there first work with db and that db is MySQL.

Let Start

First of all I am taking SELECT , INSERT, UPDATE, DELETE Command and then I shall show you how you can do some trick with your MySQL query by which your work will easy.

SELECT

SELECT * FROM "your table name"

INSERT

INSERT INTO table_name (column1,column2,column3) VALUES (value1,value2,value3,...);

UPDATE

UPDATE table_name SET column1=value1,column2=value2 WHERE some_column=some_value;

DELETE

DELETE FROM table_name WHERE some_column=some_value;

Those shown queries are basic queries which we need in our each and every task in mysql, but by the help of these queries you can do main things or by the help of combinaton of those queries you can perform CRUD operation. Let me show how.

DELETE & SELECT

DELETE FROM TABLE_A WHERE TABLE_A IN(SELECT ID FROM TABLE_B)


Get Auto increment id of your table using query

SHOW TABLE STATUS FROM `DatabaseName` LIKE 'TableName' ;

Get column defination in sql

SHOW COLUMNS FROM `actors` LIKE 'id'

Screenshot from 2016-05-15 14-57-36

Case creation in sql query 

SELECT CASE WHEN column name IS NULL THEN 1 ELSE 0 END as abc FROM table name

Screenshot from 2016-05-15 15-17-52

So those are the few MySQL tip and tricks hope you like it.  🙂

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Android
2
Animated Splash Screen to you Android App using Android Studio

Today I am switching you to one finest technology of this world and that is Android. In this tutorial I am showing you how you can create a animated Splash screen which is the first part of any android application creation.

develope
Yii2.0 Dynamic Model Creation

As per my previous shared post you have to know what is Yii 2.0 and its awesome features. If you not read these posts please read this and know little bit about Yii2.0 basic(API Web APP) . Today I am sharing you a very new feature of Yii 2.0 which will …

develope
Understand Overriding Magento Controller

Today I’m going to discussing a very cool and best Magento method which is known as overriding. Magento basically base on code pool, where all module/plugin are stored in community and core folder. But when we want to override those modules and all then we are using this awesome process …