Mysql

Only available on StudyMode
  • Topic: Delhi, SQL, Noida
  • Pages : 5 (840 words )
  • Download(s) : 156
  • Published : January 31, 2013
Open Document
Text Preview
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database company;
Query OK, 1 row affected (0.02 sec)

mysql> use company;
Database changed
mysql> create table salesman(SID char(5) primary key,Sname char(10) not null,Cit y char(15),Salary int(5),product int(20),target int(10));
Query OK, 0 rows affected (0.42 sec)

mysql> create table salesman(SID char(5) primary key,Sname char(10) not null,Cit y char(15),Salary int(5),product char(20),target int(10));
ERROR 1050 (42S01): Table 'salesman' already exists
mysql> create table Salesman(SID char(5) primary key,Sname char(10) not null,Cit y char(15),Salary int(5),product char(20),target int(10));
ERROR 1050 (42S01): Table 'salesman' already exists
mysql> create table Salesman1(SID char(5) primary key,Sname char(10) not null,Ci ty char(15),Salary int(5),product char(20),target int(10));
Query OK, 0 rows affected (0.00 sec)

mysql> insert into salesman1 values("sA","Rahul","Noida",15,000,"books",100); ERROR 1136 (21S01): Column count doesn't match value count at row 1 mysql> insert into salesman1 values("sA","Rahul","Noida",15000,"books",100); Query OK, 1 row affected (0.06 sec)

mysql> insert into salesman1 values("sB","Rohan","Delhi",25000,"Notebook",150); Query OK, 1 row affected (0.28 sec)

mysql> insert into salesman1 values("sC","Jitu","Mumbai",21200,"Paper",250); Query OK, 1 row affected (0.31 sec)

mysql> insert into salesman1 values("sD","Atul","Ghaziabad",10200,"Register",300 );
Query OK, 1 row affected (0.30 sec)

mysql> insert into salesman1 values("sE","Gaurav","Greater Noida",15200,"Folder" ,400);
Query OK, 1 row affected (0.28 sec)

mysql> desc salesman1;
+---------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------+------+-----+---------+-------+
| SID | char(5) | NO | PRI | NULL | |
| Sname | char(10) | NO | | NULL | |
| City | char(15) | YES | | NULL | |
| Salary | int(5) | YES | | NULL | |
| product | char(20) | YES | | NULL | |
| target | int(10) | YES | | NULL | |
+---------+----------+------+-----+---------+-------+
6 rows in set (0.44 sec)

mysql> create table customers(CID varchar(5) primary key,Cname varchar(10),city varchar(15),state varchar(15),product varchar(15),class char(2) default "A",pinc ode int(8));
Query OK, 0 rows affected (0.16 sec)

mysql> insert into customers values("C01","Akash","Ghaziabad","UP","Notebooks"," B",201001);
Query OK, 1 row affected (0.06 sec)

mysql> insert into customers values("C02","Mohit","Greater Noida","UP","Register ","C",201308);
Query OK, 1 row affected (0.05 sec)

mysql> insert into customers values("C03","Gaurav","Pratap Vihar","Delhi","Paper ","D",201004);
Query OK, 1 row affected (0.27 sec)

mysql> insert into customers values("C04","Sachin","RajNagar","UP","Folder","",2 01209);
Query OK, 1 row affected (0.34 sec)

mysql> insert into customers values("C05","Vinod","Noida","UP","Books","",201210 );
Query OK, 1 row affected (0.06 sec)

mysql> select * from customers;
+-----+--------+---------------+-------+-----------+-------+---------+ | CID | Cname | city | state | product | class | pincode | +-----+--------+---------------+-------+-----------+-------+---------+ | C01 | Akash | Ghaziabad | UP | Notebooks | B | 201001 | | C02 | Mohit | Greater Noida | UP | Register | C |...
tracking img