0% found this document useful (0 votes)
7 views2 pages

Dbms

Uploaded by

rattuldas99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Dbms

Uploaded by

rattuldas99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Enter password: ****

Welcome to the MySQL monitor. Commands end with ; or \g.


Your MySQL connection id is 2
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.03 sec)

mysql> create database company;


Query OK, 1 row affected (0.01 sec)

mysql> use company;


Database changed
mysql> SQL> CREATE TABLE CUSTOMERS(
-> ID INT NOT NULL,
-> NAME VARCHAR (20) NOT NULL,
-> AGE INT NOT NULL,
-> ADDRESS CHAR (25) ,
-> SALARY DECIMAL (18, 2),
-> PRIMARY KEY (ID)
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'SQL>
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE IN' at line 1
mysql> CREATE TABLE CUSTOMERS( ID INT NOT NULL, NAME VARCHAR (20) NOT NULL, AGE INT
NOT NULL, SALARY DECIMAL (18,2), PRIMARY KEY(ID) );
Query OK, 0 rows affected (0.22 sec)

mysql> Dec customers;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'Dec
customers' at line 1
mysql> desc customers;
+--------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------+------+-----+---------+-------+
| ID | int(11) | NO | PRI | | |
| NAME | varchar(20) | NO | | | |
| AGE | int(11) | NO | | | |
| SALARY | decimal(18,2) | YES | | NULL | |
+--------+---------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

mysql> insert into customers values(145,Rohit,50,300000);


ERROR 1054 (42S22): Unknown column 'Rohit' in 'field list'
mysql> insert into customers values(145,'Rohit',50,300000);
Query OK, 1 row affected (0.09 sec)
mysql> select * from customers;
+-----+-------+-----+-----------+
| ID | NAME | AGE | SALARY |
+-----+-------+-----+-----------+
| 145 | Rohit | 50 | 300000.00 |
+-----+-------+-----+-----------+
1 row in set (0.00 sec)

mysql>

You might also like