My SQL Preliminaries My Sql MYSQL is an

  • Slides: 18
Download presentation
My SQL Preliminaries

My SQL Preliminaries

My. Sql ØMYSQL is an open source software available for Linux, Mac and renders

My. Sql ØMYSQL is an open source software available for Linux, Mac and renders even M$ Windows workable. ØClient server Architecture ØNeed a client on your desktop and server on your desktop or it can be accessed through network

Assuming that mysql is installed and you are in a Comd prompt, your first

Assuming that mysql is installed and you are in a Comd prompt, your first comd…. . v He. . . lllllp ! Mysql> help; Mysql>help contents; Note you can learn entire Mysql using the ‘help feature’ without any other study Material or an Instructor!

Logging in… (required in linux. Window logs you in as root automatically and does

Logging in… (required in linux. Window logs you in as root automatically and does not insist on a password !!!!

Granting rights An ordinary user requires rights to create , modify or update database

Granting rights An ordinary user requires rights to create , modify or update database The normal procedure is • create user • create database as root user (DBA) • grant rights to user as necessary.

Adding user and granting rights

Adding user and granting rights

Dropping user and revoking rights User can be deleted by drop user Rights once

Dropping user and revoking rights User can be deleted by drop user Rights once granted can be revoked with revoke command. Specific rights like insert, update, etc can be given Eg mysql> GRANT SELECT , INSERT, UPDATE, DELETE, CREATE, DROP ON TESTDB TO ALOK;

Some Gen Rules Ø or help ØHelp contents gives list of contents ØHelp [

Some Gen Rules Ø or help ØHelp contents gives list of contents ØHelp [ specific topic] gives help on specific topic for eg ‘help select’ tells everything about ‘select’ key word. ØAll lines end with a semi colon ;

More gen rules You can break a line by enter. Command will be executed

More gen rules You can break a line by enter. Command will be executed only on semicolon

Datatypes

Datatypes

Some simple commands Show databases; Show tables; Create database dbname; Use dbname; Create tablename

Some simple commands Show databases; Show tables; Create database dbname; Use dbname; Create tablename (name char(20), marks int); Desc tablename; Select * from tablename;

CREATE DATABASE

CREATE DATABASE

CREATE TABLE

CREATE TABLE

ALTER TABLE

ALTER TABLE

FILL IN DATA WITH INSERT

FILL IN DATA WITH INSERT

RETRIEVE DATA WITH SELECT

RETRIEVE DATA WITH SELECT

UPDATE DATA

UPDATE DATA

DELETE RECORD , DROP TABLE

DELETE RECORD , DROP TABLE