NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

| Database |
+--------------------+
| information_schema |
| BVP |
| CRSoftware |
| Cetpa |
| Django |
| Hello |
| JDBC |
| Java |
| M1 |
| Mean |
| MyApp |
| MyPython |
| SIGNUP |
| carrental |
| mysql |
| performance_schema |
| phpmyadmin |
| school |
| sys |
+--------------------+
19 rows in set (0.66 sec)

mysql> create database Harsh;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| BVP |
| CRSoftware |
| Cetpa |
| Django |
| Harsh |
| Hello |
| JDBC |
| Java |
| M1 |
| Mean |
| MyApp |
| MyPython |
| SIGNUP |
| carrental |
| mysql |
| performance_schema |
| phpmyadmin |
| school |
| sys |
+--------------------+
20 rows in set (0.00 sec)

mysql> use Harsh;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> create table Student(rollno int , name varchar(20),address varchar(30));
Query OK, 0 rows affected (0.60 sec)

mysql> show tables;
+-----------------+
| Tables_in_Harsh |
+-----------------+
| Student |
+-----------------+
1 row in set (0.00 sec)

mysql> desc Student;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| rollno | int(11) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
| address | varchar(30) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
3 rows in set (0.01 sec)

mysql> insert into Student values(839,'Naveen','Mumbai');
Query OK, 1 row affected (0.00 sec)

mysql> insert into Student values(893,'Sandeep','Goa');
Query OK, 1 row affected (0.01 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.00 sec)

mysql> select * from student;
ERROR 1146 (42S02): Table 'Harsh.student' doesn't exist
mysql> select * from Student;
+--------+---------+---------+
| rollno | name | address |
+--------+---------+---------+
| 839 | Naveen | Mumbai |
| 893 | Sandeep | Goa |
| 83 | Manoj | jaipur |
+--------+---------+---------+
3 rows in set (0.00 sec)

mysql> update Student set address='Noida' where rollno=83;
Query OK, 1 row affected (0.38 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from Student;
+--------+---------+---------+
| rollno | name | address |
+--------+---------+---------+
| 839 | Naveen | Mumbai |
| 893 | Sandeep | Goa |
| 83 | Manoj | Noida |
+--------+---------+---------+
3 rows in set (0.00 sec)

mysql> delete from student where rollno=839;
ERROR 1146 (42S02): Table 'Harsh.student' doesn't exist
mysql> delete from Student where rollno=839;
Query OK, 1 row affected (0.03 sec)

mysql> select * from Student;
+--------+---------+---------+
| rollno | name | address |
+--------+---------+---------+
| 893 | Sandeep | Goa |
| 83 | Manoj | Noida |
+--------+---------+---------+
2 rows in set (0.00 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.00 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.01 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.01 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.00 sec)

mysql> select * from Student;
+--------+---------+---------+
| rollno | name | address |
+--------+---------+---------+
| 893 | Sandeep | Goa |
| 83 | Manoj | Noida |
| 83 | Manoj | jaipur |
| 83 | Manoj | jaipur |
| 83 | Manoj | jaipur |
| 83 | Manoj | jaipur |
+--------+---------+---------+
6 rows in set (0.00 sec)

mysql> truncate Student;
Query OK, 0 rows affected (0.02 sec)

mysql> select * from Student;
Empty set (0.00 sec)

mysql> insert into Student values(83,'Manoj','jaipur');
Query OK, 1 row affected (0.01 sec)

mysql> insert into Student values(84,'Sahil','mumbai');
Query OK, 1 row affected (0.00 sec)

mysql> select * from Student;
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
| 84 | Sahil | mumbai |
+--------+-------+---------+
2 rows in set (0.00 sec)

mysql> insert into Student values(85,'Anuj','Noida');
Query OK, 1 row affected (0.00 sec)

mysql> select * from Student;
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
| 84 | Sahil | mumbai |
| 85 | Anuj | Noida |
+--------+-------+---------+
3 rows in set (0.00 sec)

mysql> select name from Student;
+-------+
| name |
+-------+
| Manoj |
| Sahil |
| Anuj |
+-------+
3 rows in set (0.00 sec)

mysql> select name, address from Student where rollno=84;
+-------+---------+
| name | address |
+-------+---------+
| Sahil | mumbai |
+-------+---------+
1 row in set (0.00 sec)

mysql> select * from Student where rollno=83 && rollno=84;
Empty set (0.00 sec)

mysql> select * from Student;
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
| 84 | Sahil | mumbai |
| 85 | Anuj | Noida |
+--------+-------+---------+
3 rows in set (0.00 sec)

mysql> select * from Student where rollno=83 && name='Manoj';
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
+--------+-------+---------+
1 row in set (0.00 sec)

mysql> select * from Student where rollno=83 && name='Rajesh';
Empty set (0.00 sec)

mysql> select * from Student where rollno=83 || name='Rajesh';
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
+--------+-------+---------+
1 row in set (0.01 sec)

mysql> mysql --version
-> ;
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 'mysql --version' at line 1
mysql> select * from Student;
+--------+-------+---------+
| rollno | name | address |
+--------+-------+---------+
| 83 | Manoj | jaipur |
| 84 | Sahil | mumbai |
| 85 | Anuj | Noida |
+--------+-------+---------+
3 rows in set (0.00 sec)

mysql> alter table Student add mobile int;
Query OK, 0 rows affected (0.45 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> select * from Student;
+--------+-------+---------+--------+
| rollno | name | address | mobile |
+--------+-------+---------+--------+
| 83 | Manoj | jaipur | NULL |
| 84 | Sahil | mumbai | NULL |
| 85 | Anuj | Noida | NULL |
+--------+-------+---------+--------+
3 rows in set (0.00 sec)

mysql> update Studetn set mobile=8326289289 where rollno=83;
ERROR 1146 (42S02): Table 'Harsh.Studetn' doesn't exist
mysql> update Student set mobile=8326289289 where rollno=83;
ERROR 1264 (22003): Out of range value for column 'mobile' at row 1
mysql> update Student set mobile=83262892 where rollno=83;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from Student;
+--------+-------+---------+----------+
| rollno | name | address | mobile |
+--------+-------+---------+----------+
| 83 | Manoj | jaipur | 83262892 |
| 84 | Sahil | mumbai | NULL |
| 85 | Anuj | Noida | NULL |
+--------+-------+---------+----------+
3 rows in set (0.00 sec)

mysql> update Student set mobile=89732892 where rollno=84;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from Student;
+--------+-------+---------+----------+
| rollno | name | address | mobile |
+--------+-------+---------+----------+
| 83 | Manoj | jaipur | 83262892 |
| 84 | Sahil | mumbai | 89732892 |
| 85 | Anuj | Noida | NULL |
+--------+-------+---------+----------+
3 rows in set (0.00 sec)

mysql> alter table Student drop column adderess;
ERROR 1091 (42000): Can't DROP 'adderess'; check that column/key exists
mysql> alter table Student drop column address;
Query OK, 0 rows affected (0.08 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> select * from Student;
+--------+-------+----------+
| rollno | name | mobile |
+--------+-------+----------+
| 83 | Manoj | 83262892 |
| 84 | Sahil | 89732892 |
| 85 | Anuj | NULL |
+--------+-------+----------+
3 rows in set (0.01 sec)

mysql> insert into Student values(,'Anuj','Noida');
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 ''Anuj','Noida')' at line 1
mysql> insert into Student values('','Anuj','Noida');
ERROR 1366 (HY000): Incorrect integer value: '' for column 'rollno' at row 1
mysql> insert into Student values(90,'Anuj','');
ERROR 1366 (HY000): Incorrect integer value: '' for column 'mobile' at row 1
mysql> insert into Student values(90,'',9459304343);
ERROR 1264 (22003): Out of range value for column 'mobile' at row 1
mysql> insert into Student values(90,'',945930434);
Query OK, 1 row affected (0.01 sec)

mysql> select * from Student;
+--------+-------+-----------+
| rollno | name | mobile |
+--------+-------+-----------+
| 83 | Manoj | 83262892 |
| 84 | Sahil | 89732892 |
| 85 | Anuj | NULL |
| 90 | | 945930434 |
+--------+-------+-----------+
4 rows in set (0.00 sec)

mysql> insert into Student values(90,null,945930434);
Query OK, 1 row affected (0.01 sec)

mysql> select * from Student;
+--------+-------+-----------+
| rollno | name | mobile |
+--------+-------+-----------+
| 83 | Manoj | 83262892 |
| 84 | Sahil | 89732892 |
| 85 | Anuj | NULL |
| 90 | | 945930434 |
| 90 | NULL | 945930434 |
+--------+-------+-----------+
5 rows in set (0.00 sec)

mysql> create table employee(eid int primary key, ename varchar(20),eaddr varchar(20));
Query OK, 0 rows affected (0.03 sec)

mysql> descemployee;
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 'descemployee' at line 1
mysql> desc employee;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| eid | int(11) | NO | PRI | NULL | |
| ename | varchar(20) | YES | | NULL | |
| eaddr | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> create table emp_detalis(eid int ,edes varchar(20),Foreign key(eid) refrences employee(eid));
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 'refrences employee(eid))' at line 1
mysql> create table emp_detalis(eid int ,edes varchar(20),Foreign key(eid) references employee(eid));
Query OK, 0 rows affected (0.03 sec)

mysql> desc emp_details;
ERROR 1146 (42S02): Table 'Harsh.emp_details' doesn't exist
mysql> desc emp_detalis;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| eid | int(11) | YES | MUL | NULL | |
| edes | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> desc employee;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| eid | int(11) | NO | PRI | NULL | |
| ename | varchar(20) | YES | | NULL | |
| eaddr | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> insert into employee values(45,'Sujeet','Delhi' );
Query OK, 1 row affected (0.00 sec)

mysql> insert into employee values(43,'Majeet','Goa' );
Query OK, 1 row affected (0.00 sec)

mysql> insert into employee values(43,'Suresh','Jaipur' );
ERROR 1062 (23000): Duplicate entry '43' for key 'PRIMARY'
mysql> insert into employee values(45,'Suresh','Jaipur' );
ERROR 1062 (23000): Duplicate entry '45' for key 'PRIMARY'
mysql> insert into employee values(47,'Suresh','Jaipur' );
Query OK, 1 row affected (0.00 sec)

mysql> select * from employee;
+-----+--------+--------+
| eid | ename | eaddr |
+-----+--------+--------+
| 43 | Majeet | Goa |
| 45 | Sujeet | Delhi |
| 47 | Suresh | Jaipur |
+-----+--------+--------+
3 rows in set (0.00 sec)

mysql> desc emp_detalis;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| eid | int(11) | YES | MUL | NULL | |
| edes | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> insert into emp_detalis(46,'java Developer');
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 '46,'java Developer')' at line 1
mysql> insert into emp_detalis(46,'javaDeveloper');
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 '46,'javaDeveloper')' at line 1
mysql> insert into emp_detalis(43,'javaDeveloper');
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 '43,'javaDeveloper')' at line 1
mysql> select * from employee;
+-----+--------+--------+
| eid | ename | eaddr |
+-----+--------+--------+
| 43 | Majeet | Goa |
| 45 | Sujeet | Delhi |
| 47 | Suresh | Jaipur |
+-----+--------+--------+
3 rows in set (0.00 sec)

mysql> insert into emp_detalis values(46,'java Developer');
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`Harsh`.`emp_detalis`, CONSTRAINT `emp_detalis_ibfk_1` FOREIGN KEY (`eid`) REFERENCES `employee` (`eid`))
mysql> insert into emp_detalis values(43,'java Developer');
Query OK, 1 row affected (0.01 sec)

mysql> ^C
mysql> insert into emp_detalis values(45,'Accountant');
Query OK, 1 row affected (0.01 sec)

mysql> insert into emp_detalis values(47,'HR');
Query OK, 1 row affected (0.00 sec)

mysql> select * from emp_detalis;
+------+----------------+
| eid | edes |
+------+----------------+
| 43 | java Developer |
| 45 | Accountant |
| 47 | HR |
+------+----------------+
3 rows in set (0.00 sec)

mysql> select * from employee;
+-----+--------+--------+
| eid | ename | eaddr |
+-----+--------+--------+
| 43 | Majeet | Goa |
| 45 | Sujeet | Delhi |
| 47 | Suresh | Jaipur |
+-----+--------+--------+
3 rows in set (0.00 sec)

mysql> select ename from employee inner join emp_detalis.eid=employee.eid;
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 '.eid' at line 1
mysql> select ename , edes from employee inner join emp_detalis on employee.eid=emp_detalis.eid;
+--------+----------------+
| ename | edes |
+--------+----------------+
| Majeet | java Developer |
| Sujeet | Accountant |
| Suresh | HR |
+--------+----------------+
3 rows in set (0.00 sec)

mysql> select ename,eaddr , edes from employee inner join emp_detalis on employee.
+--------+--------+----------------+
| ename | eaddr | edes |
+--------+--------+----------------+
| Majeet | Goa | java Developer |
| Sujeet | Delhi | Accountant |
| Suresh | Jaipur | HR |
+--------+--------+----------------+
3 rows in set (0.00 sec)

mysql> select ename,eaddr,eid , edes from employee inner join emp_detalis on employee.eid=emp_detalis.eid;
ERROR 1052 (23000): Column 'eid' in field list is ambiguous
mysql> select,eid ename,eaddr , edes from employee inner join emp_detalis on employee.eid=emp_detalis.eid;
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 'eid ename,eaddr , edes from employee inner join emp_detalis on employee.eid=emp_' at line 1
mysql> select eid ,ename,eaddr , edes from employee inner join emp_detalis on employee.eid=emp_detalis.eid;
ERROR 1052 (23000): Column 'eid' in field list is ambiguous
mysql> select eid ,ename,eaddr , edes from employee inner join emp_detalis on employee.ename=emp_detalis.ename;
ERROR 1052 (23000): Column 'eid' in field list is ambiguous
mysql> select ,eaddr , edes from employee inner join emp_detalis on employee.ename=emp_detalis.ename;
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 'eaddr , edes from employee inner join emp_detalis on employee.ename=emp_detalis.' at line 1
mysql> select eaddr , edes from employee inner join emp_detalis on employee.ename=emp_detalis.ename;
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.