Create a Database using ZOHO platform. It can be done by pasting spreadsheet data into the table. Our database table would look like
After creating a database we can update, delete and request information from databases. And to do this we have to run a query using SQL.
There are some standard SQL commands such as “Select”, “Insert”, “Update”, “Delete”, “Create”, and “Drop” which can be used to accomplish almost everything that one needs to do with a database. Writing command in this language is generally simple as it is basically English like language. We just need to stick to some conventions of the language.
So let’s start with simple command which can show us first name, last name , Salary and designation of the employee.
Select “LastName”,”FirstName”,”Salary”,”Designation” from “Employee”;
Let’s Make it little Complicated by including condition to show data of only those employees whose designation is either ‘Manager’ or ‘secretary’; to do this our command would be
Select “LastName”,”FirstName”,”Salary”,”Designation” from “Employee” where “Designation”=’manager’ or “Designation”=’secretary’;
And it output will be
There is one important command in SQL which can join data from two tables. If we want to join the information from Employee table to Department table then this command is very useful. As if we want to see, employee ID, last name, first name from the employee and department name and location in which he/she works we use this command to join the data from these two tables. The command is as simple as English language.
Let’s see how it works
SELECT “Emp_ID”, “LastName”, “FirstName”,”Dept_Name”,”Location” FROM “Employee”,”Department” where “Employee”.”Dept”=”Dept_ID”;
This command will throw a table like this
The best thing of this kind of data model we can use multiple conditions of SQL language to get more refined and more specific result. Let’s take an example that you want the employee ID’s , first name, last names and designations of employees whose designation is manager or his/her salary is more than 15000 or his name is Rahul. This task looks difficult in general but writing a SQL command for this task is as simple as it is writing it in English language with some use of logical statements. Have a look at this also
SELECT “Emp_ID”, “LastName”, “FirstName”,”Designation” FROM “Employee” where “Salary” >15000 or “FirstName”=’Rahul’ or “Designation”=’Manager’;
It’s output is
I think that’s all for the time being.
very good