Tuesday 25 November, 2008

second lecture of mysql

mysql>create database student;
student;to create new database
Result:: Query OK,1 row affected <0.01>it means database is created
successfully
To Connect to the database
mysql>connect student;

This will change the database to student but on command
prompt we will have still"mysql> " prompt
Database is a logical concept it will have tables in
physicallity so now create tables in a database
mysql> create table cls(name varchar(50),rollno int(11));
Result : Query ok ,etc...a table with name cls is
created having fields name type varchar means we
can enter text of max length 50 rollno is integer having length 11int can work without integer
length also now insert data to the table Insert command
to assign values as per the structure of the table the use
following commandmysql> insert into cls
values("Parveen",122);remember this will work only if
u pass values as per the structure of the table
Note ::Where clause does not work with insert if u
understand then ok otherwise we will discuss later on
insert can work like this if u want to give value to the
particular field
mysql>insert into cls(rollno) values(234);
this will insert data in the rollno field only and
corresponding name field will be empty which is a bad
practice. This is for the knowledge of
the programmer Resutl Query ok etc...
Another format of insert command is
with set attribute
mysql> insert into cls set rollno=123, name="news";
Result :Query okin this example order does
not matter.

First lecture of mysql

Introductory notes of mysql mysql is a database software supported by php
programming language To use this database first of
all install this database software there are different
types of methods of installing it I m giving here example of
this first of all it will ask the name
of server type localhost then type any email address
in next textbox as require it can be faque also but u
should use @ symbol as this simple is judge by the
computer to consider it as an email id
Important steps to start start mysql generally from Start menu progamms
1) mysql command line client
2) Then it will ask for
password on mysql prompt
type the password now start my sql.
First Command
mysql>Show databases;
note remember its not a database but databses and
also remember to use semicolon always for
termination as this is the most common mistake while typing.
Result it will show name of already
existing databases in tabular form