Archive for the ‘MYSQL’ Category

Create and grant privileges to user in MySQL

Create user in MySQL

CREATE USER 'jijokjose'@'localhost' IDENTIFIED BY 'jijokjose';


Grant all privileges to user in MySQL

GRANT ALL PRIVILEGES ON *.* TO 'jijokjose'@'localhost' WITH GRANT OPTION;


Create database in MySQL

CREATE DATABASE db_vc;


Login using CMD

mysql –user=jijokjose –password=jijokjose db_name


Import database file using CMD

H:\>mysql -u jijokjose -p db_vc < H:\\db_vc.sql
Enter password: *********


Read more »

Counting DISTINCT over multiple columns in SQL

My database contents

ID CLASS_CODE ROLL_NO NAME
1 IX 1 Jijo K Jose
2 IX 3 James Jacob
3 X 1 Joy Mathew
4 X 2 Sam George
5 IX 2 Miller John
6 X 3 Thomas John

Display values of distinct rows over one column

select distinct(ROLL_NO) from STUDENT;

ROLL_NO  
1
3
2

Read more »

How to delete DIV dynamically using JQuery

To download the code – Click Here

To delete or modify HTML contents we need to use JQuery or any other similar scripting methods.

In this example there are 3 DIV's and it can be deleted dynamically. When we click on the [ X ] button the corresponding DIV was deleted and also it send a POST request to delete.php so we can also delete the corresponding user from the database.

Live Demo


 

Read more »