Notes
Notes - notes.io |
DEPT_ID INT PRIMARY KEY,
DEPT_NAME VARCHAR(50),
LOCATION VARCHAR(50)
);
INSERT INTO DEPT (DEPT_ID, DEPT_NAME, LOCATION)
VALUES
(1, 'HR', 'New York'),
(2, 'Engineering', 'San Francisco'),
(3, 'Marketing', 'Los Angeles');
SELECT * FROM DEPT;
CREATE TABLE DEPT (
DEPT_ID INT PRIMARY KEY,
DEPT_NAME VARCHAR(50),
LOCATION VARCHAR(50)
);
INSERT INTO DEPT (DEPT_ID, DEPT_NAME, LOCATION)
VALUES
(1, 'HR', 'New York'),
(2, 'Engineering', 'San Francisco'),
(3, 'Marketing', 'Los Angeles');
SELECT * FROM DEPT;
CREATE TABLE EMP (
empid INT PRIMARY KEY,
empname VARCHAR(50),
deptid INT
);
INSERT INTO EMP (empid, empname, deptid)
VALUES
(1, 'John Doe', 101),
(2, 'Jane Smith', 102),
(3, 'Michael Johnson', 101),
(4, 'Emily Brown', 103),
(5, 'David Lee', 102),
(6, 'Sarah Williams', 103);
SELECT DISTINCT deptid
FROM EMP;
CREATE TABLE EMPLOYEE (
empid INT PRIMARY KEY,
empname VARCHAR(50),
salary DECIMAL(10, 2)
);
INSERT INTO EMPLOYEE (empid, empname, salary)
VALUES
(1, 'John Doe', 50000.00),
(2, 'Jane Smith', 60000.00),
(3, 'Michael Johnson', 75000.00),
(4, 'Emily Brown', 70000.00),
(5, 'David Lee', 80000.00),
(6, 'Sarah Williams', 72000.00);
SELECT empname, salary
FROM EMPLOYEE
WHERE salary = (SELECT MAX(salary) FROM EMPLOYEE);
---------------------------
CREATE TABLE EMPLOYEE (
empid INT PRIMARY KEY,empname VARCHAR(50),department VARCHAR(50));
INSERT INTO EMPLOYEE (empid, empname, department)
VALUES
(1, 'John Doe', 'HR'),
(2, 'Jane Smith', 'Finance'),
(3, 'Michael Johnson', 'IT'),
(4, 'Emily Brown', 'Sales');
CREATE TABLE CUSTOMER (
customerid INT PRIMARY KEY,customername VARCHAR(50),empid INT,FOREIGN KEY (empid) REFERENCES EMPLOYEE(empid));
INSERT INTO CUSTOMER (customerid, customername, empid)
VALUES
(101, 'Acme Corp', 1),
(102, 'XYZ Inc', 3),
(103, 'ABC Ltd', 2),
(104, '123 Enterprises', 4);
SELECT EMPLOYEE.empid, empname, department, customerid, customername
FROM EMPLOYEE
LEFT JOIN CUSTOMER ON EMPLOYEE.empid = CUSTOMER.empid;
|
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