Sign up
Login
New
Trending
Archive
English
English
Sign up
Login
New Paste
Add Image
Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.40 MySQL Community Server - GPL Copyright (c) 2000, 2024, Oracle and/or its affiliates. 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> SELECT * from employee;3 ERROR 1046 (3D000): No database selected -> ; 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 '3' at line 1 mysql> USE company3 ERROR 1049 (42000): Unknown database 'company3' mysql> USE company Database changed mysql> SELECT * from employee;3 +--------+-----------+-----------+---------+ | emp_id | name | salary | dept_id | +--------+-----------+-----------+---------+ | 101 | Raj Kumar | 15000.00 | 23 | | 102 | Karmarr | 155000.00 | 24 | | 103 | Ajumar | 150500.00 | 25 | | 104 | Amar | 25000.00 | 26 | | 105 | PRaj | 265000.00 | 20 | | 106 | Humar | 45000.00 | 2 | +--------+-----------+-----------+---------+ 6 rows in set (0.00 sec) -> ; 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 '3' at line 1 mysql> INSERT INTO dept VALUES(2, "Testing", "Remote"); Query OK, 1 row affected (0.03 sec) mysql> INSERT INTO dept VALUES(20, "Anger Management", "Delhi"); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO dept VALUES(20, "Chocolate Quality Divison", "Budapest"); ERROR 1062 (23000): Duplicate entry '20' for key 'dept.PRIMARY' mysql> mysql> INSERT INTO dept VALUES(23, "Chocolate Quality Divison", "Budapest"); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO dept VALUES(24, "Road Safety Division", "Patna"); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO dept VALUES(25, "Cyber Security", "San Fransisco"); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO dept VALUES(26, "Sales","Antartica"); Query OK, 1 row affected (0.01 sec) mysql> SELECT * from dept; +---------+---------------------------+---------------+ | dept_id | dept_name | location | +---------+---------------------------+---------------+ | 2 | Testing | Remote | | 20 | Anger Management | Delhi | | 23 | Chocolate Quality Divison | Budapest | | 24 | Road Safety Division | Patna | | 25 | Cyber Security | San Fransisco | | 26 | Sales | Antartica | +---------+---------------------------+---------------+ 6 rows in set (0.00 sec) mysql> SELECT * from employee; +--------+-----------+-----------+---------+ | emp_id | name | salary | dept_id | +--------+-----------+-----------+---------+ | 101 | Raj Kumar | 15000.00 | 23 | | 102 | Karmarr | 155000.00 | 24 | | 103 | Ajumar | 150500.00 | 25 | | 104 | Amar | 25000.00 | 26 | | 105 | PRaj | 265000.00 | 20 | | 106 | Humar | 45000.00 | 2 | +--------+-----------+-----------+---------+ 6 rows in set (0.00 sec) mysql> ALTER TABLE employee -> ADD email VARCHAR(50); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE employee -> ADD post VARCHAR(50); Query OK, 0 rows affected (0.03 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> INSERT INTO employee(email, post) VALUES("a@a.com","Head") WHERE emp_id=101; 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 'WHERE emp_id=101' at line 1 mysql> INSERT INTO employee(email, post) VALUES("a@a.com","Head") WHERE employee.emp_id=101; 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 'WHERE employee.emp_id=101' at line 1 mysql> UPDATE employee(email, post) VALUES("a@a.com","Head") WHERE employee.emp_id=101; 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 '(email, post) VALUES("a@a.com","Head") WHERE employee.emp_id=101' at line 1 mysql> UPDATE employee -> SET email="a@a.com" and post="Head" WHERE emp_id=101; ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'a@a.com' mysql> DESC employee; +---------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+---------------+------+-----+---------+-------+ | emp_id | int | NO | PRI | NULL | | | name | varchar(70) | YES | | NULL | | | salary | decimal(10,2) | YES | | NULL | | | dept_id | int | YES | | NULL | | | email | varchar(50) | YES | | NULL | | | post | varchar(50) | YES | | NULL | | +---------+---------------+------+-----+---------+-------+ 6 rows in set (0.02 sec) mysql> UPDATE employee SET email="a@a.com" and post="Head" WHERE emp_id=101; ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'a@a.com' mysql> UPDATE employee SET email="a@a.com" WHERE emp_id=101; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET email="a@an.com" WHERE emp_id=102; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET email="ak@an.com" WHERE emp_id=103; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET email="ak@anh.com" WHERE emp_id=104; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET email="agk@anh.com" WHERE emp_id=105; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET email="agk@ganh.com" WHERE emp_id=106; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> ALTER TABLE employee -> ADD CONSTRAINT dept_link -> FOREIGN KEY(dept_id) REFERENCES dept(dept_id); Query OK, 6 rows affected (0.08 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> UPDATE employee SET post="Clerk" WHERE emp_id=101; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET post="Boss" WHERE emp_id=102; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET post="Manager" WHERE emp_id=103; Query OK, 1 row affected (0.03 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET post="Delivery Head" WHERE emp_id=104; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET post="CTO" WHERE emp_id=105; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> UPDATE employee SET post="Software Guy" WHERE emp_id=106; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> SELECT * from employee; +--------+-----------+-----------+---------+--------------+---------------+ | emp_id | name | salary | dept_id | email | post | +--------+-----------+-----------+---------+--------------+---------------+ | 101 | Raj Kumar | 15000.00 | 23 | a@a.com | Clerk | | 102 | Karmarr | 155000.00 | 24 | a@an.com | Boss | | 103 | Ajumar | 150500.00 | 25 | ak@an.com | Manager | | 104 | Amar | 25000.00 | 26 | ak@anh.com | Delivery Head | | 105 | PRaj | 265000.00 | 20 | agk@anh.com | CTO | | 106 | Humar | 45000.00 | 2 | agk@ganh.com | Software Guy | +--------+-----------+-----------+---------+--------------+---------------+ 6 rows in set (0.00 sec) mysql> SELECT * from dept; +---------+---------------------------+---------------+ | dept_id | dept_name | location | +---------+---------------------------+---------------+ | 2 | Testing | Remote | | 20 | Anger Management | Delhi | | 23 | Chocolate Quality Divison | Budapest | | 24 | Road Safety Division | Patna | | 25 | Cyber Security | San Fransisco | | 26 | Sales | Antartica | +---------+---------------------------+---------------+ 6 rows in set (0.00 sec) mysql> SELECT * from employee, dept WHERE employee.dept_id=dept.dept_id; +--------+-----------+-----------+---------+--------------+---------------+---------+---------------------------+---------------+ | emp_id | name | salary | dept_id | email | post | dept_id | dept_name | location | +--------+-----------+-----------+---------+--------------+---------------+---------+---------------------------+---------------+ | 101 | Raj Kumar | 15000.00 | 23 | a@a.com | Clerk | 23 | Chocolate Quality Divison | Budapest | | 102 | Karmarr | 155000.00 | 24 | a@an.com | Boss | 24 | Road Safety Division | Patna | | 103 | Ajumar | 150500.00 | 25 | ak@an.com | Manager | 25 | Cyber Security | San Fransisco | | 104 | Amar | 25000.00 | 26 | ak@anh.com | Delivery Head | 26 | Sales | Antartica | | 105 | PRaj | 265000.00 | 20 | agk@anh.com | CTO | 20 | Anger Management | Delhi | | 106 | Humar | 45000.00 | 2 | agk@ganh.com | Software Guy | 2 | Testing | Remote | +--------+-----------+-----------+---------+--------------+---------------+---------+---------------------------+---------------+ 6 rows in set (0.00 sec) mysql> SELECT emp_id, name, salary, email, post, dept_name from employee, dept WHERE employee.dept_id=dept.dept_id; +--------+-----------+-----------+--------------+---------------+---------------------------+ | emp_id | name | salary | email | post | dept_name | +--------+-----------+-----------+--------------+---------------+---------------------------+ | 101 | Raj Kumar | 15000.00 | a@a.com | Clerk | Chocolate Quality Divison | | 102 | Karmarr | 155000.00 | a@an.com | Boss | Road Safety Division | | 103 | Ajumar | 150500.00 | ak@an.com | Manager | Cyber Security | | 104 | Amar | 25000.00 | ak@anh.com | Delivery Head | Sales | | 105 | PRaj | 265000.00 | agk@anh.com | CTO | Anger Management | | 106 | Humar | 45000.00 | agk@ganh.com | Software Guy | Testing | +--------+-----------+-----------+--------------+---------------+---------------------------+ 6 rows in set (0.00 sec) mysql> THIS WAS FROM THE SIMPLE. SQL file CREATE DATABASE company; USE company; CREATE TABLE employee( emp_id INT PRIMARY KEY, name VARCHAR(70), salary DECIMAL(10,2), dept_id INT ); CREATE TABLE dept( dept_id INT PRIMARY KEY, dept_name VARCHAR(30), location VARCHAR(50) ) SELECT * from dept; INSERT INTO employee VALUES(101,"Raj Kumar", 15000.00, 23); INSERT INTO employee VALUES(102,"Karmarr", 155000.00, 24); INSERT INTO employee VALUES(103,"Ajumar", 150500.00, 25); INSERT INTO employee VALUES(104,"Amar", 25000.00, 26); INSERT INTO employee VALUES(105,"PRaj", 265000.00, 20); INSERT INTO employee VALUES(106,"Humar", 45000.00, 2); SELECT * from employee;
Settings
Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English