BEGIN TRANSACTION;
/* Create a table with employees */
CREATE TABLE Employees(Id integer, Name text, Joined date);
INSERT INTO Employees VALUES(1,'William Riker', '2017-05-30');
INSERT INTO Employees VALUES(2,'Jean-Luc Picard', '2016-01-31');
INSERT INTO Employees VALUES(3,'Worf', '2017-07-14');
INSERT INTO Employees VALUES(4,'Data', '2017-03-21');
INSERT INTO Employees VALUES(5,'Geordi LaForge', '2017-08-20');
INSERT INTO Employees VALUES(6,'Tuvoc', '2018-01-15');
INSERT INTO Employees VALUES(7,'Benjamin Sisko', '2015-04-16');
INSERT INTO Employees VALUES(8,'Beverly Crusher', '2013-07-18');
INSERT INTO Employees VALUES(9,'Deanna Troi', '2014-03-11');
INSERT INTO Employees VALUES(10,'Kathryn Janeway', '2012-10-03');
/* Create a table with hierarchy structure */
CREATE TABLE Hierarchy(EmployeeId integer, ManagerId integer);
INSERT INTO Hierarchy VALUES(1, 2);
INSERT INTO Hierarchy VALUES(2, 10);
INSERT INTO Hierarchy VALUES(3, 7);
INSERT INTO Hierarchy VALUES(4, 2);
INSERT INTO Hierarchy VALUES(5, 2);
INSERT INTO Hierarchy VALUES(6, 10);
INSERT INTO Hierarchy VALUES(7, 10);
INSERT INTO Hierarchy VALUES(8, 2);
INSERT INTO Hierarchy VALUES(9, 2);
/* Create a table with departments */
CREATE TABLE Departments(Id integer, Name text);
INSERT INTO Departments VALUES(1, 'Accounting');
INSERT INTO Departments VALUES(2, 'Sales');
INSERT INTO Departments VALUES(3, 'IT');
INSERT INTO Departments VALUES(4, 'Research & Development');
INSERT INTO Departments VALUES(5, 'Human Resources');
/* Create a table which assignes employees to departments */
CREATE TABLE DepartmentsEmployees(DepartmentId integer, EmployeeId integer);
INSERT INTO DepartmentsEmployees VALUES(1, 1);
INSERT INTO DepartmentsEmployees VALUES(2, 2);
INSERT INTO DepartmentsEmployees VALUES(2, 3);
INSERT INTO DepartmentsEmployees VALUES(2, 4);
INSERT INTO DepartmentsEmployees VALUES(3, 5);
INSERT INTO DepartmentsEmployees VALUES(3, 6);
INSERT INTO DepartmentsEmployees VALUES(4, 7);
INSERT INTO DepartmentsEmployees VALUES(4, 8);
INSERT INTO DepartmentsEmployees VALUES(4, 9);
INSERT INTO DepartmentsEmployees VALUES(5, 10);
/* Create a table with employees' salaries */
CREATE TABLE Salary(EmployeeId integer, Salary integer);
INSERT INTO Salary VALUES(1, 33000);
INSERT INTO Salary VALUES(2, 45000);
INSERT INTO Salary VALUES(3, 28000);
INSERT INTO Salary VALUES(4, 52000);
INSERT INTO Salary VALUES(5, 35500);
INSERT INTO Salary VALUES(6, 39750);
INSERT INTO Salary VALUES(7, 43800);
INSERT INTO Salary VALUES(8, 56000);
INSERT INTO Salary VALUES(9, 46600);
INSERT INTO Salary VALUES(10, 61000);
COMMIT;
/* Exercise #1: */ Select '';
/* Display all employees' names and date of join who joined after January 1st 2015. */
--your code here
/* Exercise #2: */ Select '';
/* Display all employees' names and the name of the department they are assigned to. */
--your code here
/* Exercise #3: */ Select '';
/* Display the employee who joined last. */
--your code here
/* Exercise #4: */ Select '';
/* Display the name of every employee and the name of his superior. If an employee doesn't have a superior, display NULL. */
--your code here
/* Exercise #5: */ Select '';
/* Display average salary per department, only consider departments that have at least 2 employees. */
--your code here
About Online Sqlite Compiler
Try our Online Sqlite Compiler (Version SQLite v3.20.1) to Edit, Run, and Share your Sqlite Code directly from your browser. This online development environment provides you the latest version SQLite v3.20.1.
How to use Online Sqlite Compiler?
Write and Execute Code
- Write your program (or, paste it) directly under the "Source Code" tab.
- If you want to save your program, go to the "Project" menu and save it.
- You can directly execute your program without saving it by clicking on on "Execute" button.
User Input
The latest version of Coding Ground allows to provide program input at run time from the termnial window exactly the same way as you run your program at your own computer. So simply run a program and provide your program input (if any) from the terminal window available in the right side.
Online Sqlite Compiler: Keyboard Shortcuts
The following are the keyword shortcut of this Online Sqlite Compiler:
Shortcut | Description |
⌘ + Enter | Run the program |
⌘ + S | Save Project (Login Required) |
⇧ + ⌘ + S | Save As Project |
⌘ + P | New Project |
⌘ + G | Share Project |
⌘ + Z | Undo Editing |
⌘ + Y | Redo Editing |
⌘ + A | Select All Text |
⌘ + X | Cut Selected Text |
⌘ + C | Copy Selected Text |
⌘ + V | Paste Copied Text |
⌘ + F | Search Text |
⌘ + ⌥ + F | Replace Text |
Shortcut | Description |
Ctrl + Enter | Run the program |
Ctrl + S | Save Project |
Shift + Ctrl + S | Save As Project |
Ctrl + G | Share Project |
Ctrl + Z | Undo Editing |
Ctrl + Y | Redo Editing |
Ctrl + A | Select All Text |
Ctrl + X | Cut Selected Text |
Ctrl + C | Copy Selected Text |
Ctrl + V | Paste Copied Text |
Ctrl + F | Search Text |
Ctrl + H | Replace Text |
Online Sqlite Compiler: Save and Share Sqlite Code (Project)
Save Sqlite Project Online
You can save your Sqlite Project with us so that you can access this project later on. To save a project you will need to create a login Id with us. So before you save a project, please create a login Id using a link given at the top right corner of this page.
Share Sqlite Project Online
You can use this feature to share your Sqlite Code with your teachers, classmates and colleagues. Just click Share Button and it will create a short link, which can be shared through Email, WhatsApp or even through Social Media. A shared link will be deleted if it has been passive for almost 3 months.
More Features of Online Sqlite Compiler
- Theme – You can change the current editor's theme from the "Editor Theme" option under "Settings" menu.
- Font Size – You can change the font size of the editor /compiler from from the "Font Size" option under "Settings" menu.
- Tab Size – You can change the tab size from the "Tab Size" option under "Settings" Menu.
- Show/Hide Line Numbers – You can show/hide the line number with the code from the "Show Line Numbers" or "Hide Line Numbers" option under "Settings" Menu.
- And, many more.
Benefits of Using Online Sqlite Compiler
There are several benefits of using the Online Sqlite Compiler to run your Sqlite code:
- Platform independence: You can run your code from any device without taking care of operating systems.
- Convenience: You don't need to install anything for using this.
- No setup required: There is no need for additional setup to run your code.
- Updated version: Our online compiler/editors/terminals are the latest up-to-date.