{"id":22256974,"url":"https://github.com/pratikrameshmajage/mysql","last_synced_at":"2025-07-03T16:32:14.978Z","repository":{"id":264616502,"uuid":"892048324","full_name":"PratikRameshMajage/MYSQL","owner":"PratikRameshMajage","description":"SQL_PRACTICE_QUESTIONS | NOTES. 📝 | APNA COLLAGE | SMITH INSTITUTE | FUSSION INSTITUTE | 📚 THIS REPOSITORY DOCUMENTS MY JOURNEY OF LEARNING MYSQL, ONE OF THE MOST POPULAR RELATIONAL DATABASE MANAGEMENT SYSTEMS. 🗄️","archived":false,"fork":false,"pushed_at":"2024-12-02T09:34:48.000Z","size":8689,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-27T07:50:31.992Z","etag":null,"topics":["cascade","clauses","constraints","dcl","ddl","dml","dql","join","mysql","sql","subqueries","tcl"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PratikRameshMajage.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-21T12:22:47.000Z","updated_at":"2025-01-25T06:02:14.000Z","dependencies_parsed_at":"2024-11-25T11:34:21.647Z","dependency_job_id":"c5df97ce-54c0-4bf6-a2b6-faedab4cbac7","html_url":"https://github.com/PratikRameshMajage/MYSQL","commit_stats":null,"previous_names":["pratikrameshmajage/mysql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PratikRameshMajage/MYSQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PratikRameshMajage%2FMYSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PratikRameshMajage%2FMYSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PratikRameshMajage%2FMYSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PratikRameshMajage%2FMYSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PratikRameshMajage","download_url":"https://codeload.github.com/PratikRameshMajage/MYSQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PratikRameshMajage%2FMYSQL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263360800,"owners_count":23454786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cascade","clauses","constraints","dcl","ddl","dml","dql","join","mysql","sql","subqueries","tcl"],"created_at":"2024-12-03T08:09:17.188Z","updated_at":"2025-07-03T16:32:14.946Z","avatar_url":"https://github.com/PratikRameshMajage.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# mysql Notes:\n- Data: Logic Absent | Not Logically Processes | Conclusion is Not Present | Present in Row Format.\n- Infromation: Logically Process | Logic is Present | Conclusion is Possible | SQL queries.\n- SQL - Mical Widenius - Data Sientiest - later Acquire by Oracle | It is Not Case Sensitive.\n- Dtabase: Collections of Tables | Subset of Table | Digital Format | Easily Accesible\n- DBMS:Database Management System | Software Application Used to Manage our Database (DB) \n- User = SQL - DBMS = Database\n- RDBMS (SQL): Relational Database Management System | Data Store in Tables: MySql, Oracle, Postgre SQL, SQl Server \n- NON-RDBMS (No-SQL): Non-Relational Database Management System | Data Store in Documents: Mongodb, Tsql \n- SQL: Structure Query Language | Used to Interact with Relational Database.\n- SEQUEL: Structure English Query Language.\n- Table: COllections of Rows and Columns.\n- Row: Horizontal | Preticular Object Data | Indivisual Data.\n- Column: Vertical | Attributes | Schema | Design | General Structure.\n- CRUD: CREATE | UPDATE | READ | DELETE.\n- Workbench - Graphical User Interface (GUI). \n- MySql Command Line Client Unicode.\n- SQl Families: Total 5 No Of Families. \n1. DDL: Data Defination Language.\n    Create | Alter | Rename | Truncate | Drop | Describe\n2. DML: Data Manuplation Language.\n    Insert | Update | Delete\n3. DQL: Data Query Language\n    Select - Clauses: Where | Order by | Group by | Having  \n4. DCL: Data Control Language. \n    Grant | Revoke - Permission To User. \n5. TCL: Transation Control Language.\n    Set Autocommit = 0, Start Transation - Commit | Rollback to | SavePoint \n\n- Data Types: They define Types of Values Stored in Columns.\n    - Char: Single Charecter | Fix Length | Memory Loss. 0 to 255\n    - Varchar(20): Collection of Strings | Dynamically Occupies Memory | Efficient. 0 to 255\n    - Blob: Store Binary Large Object\n    - Int: Integer\n    - TinyInt: Small Integer | Signed(-128 to 127) \u0026 Unsigned(0 to 255)\n    - BigInt: Large Integer\n    - Bit: Bit values\n    - Float: Decimal Numbers - 23\n    - Double: Decimal Numbers - 24 to 53\n    - Boolean: 0 or 1\n    - Date: yyyy|mm|dd\n    - Year: 1990. \n- Operators:\n    - Arithmatic Operaors: + | - | * | / | % \n    - Logical Operators:\n        - And\n        - Or(Single Row Condition) \n        - In (Multirow Condition (For Multiple Element)) \n        - Is ( To check Null Values )\n        - IS Not\n        - Between (Inclusive)\n        - All \n        - Like\n        - Any \n    - Comparison: \n        -   = : Equal to\n        -  != : Not Equal to\n        -  \u003c  : Less Than \n        -  (\u003e): Greater Than\n        -  \u003c= : Less Than Equal To\n        -  (\u003e=):GRater than Equal to\n    - Bitwise:\n        - \u0026(BItwiseAnd), |(BitwiseOr)  \n        \n# MySQL Codes: \n```sql\n-- 18|11|24 APANA COLLAGE\ncreate database collage;\nues collage;\n\ncreate table student(\n    id int primary key,\n    name varchar(20),\n    age int not null\n);\n\ninsert into student values (1,\"Aman\",26);\ninsert into student values (1,\"Shradha\",24);\n\nselect * from student;\n\n-- DataBase Related Queries:\n-- create database db_name;\n-- create database if not exist db_name;\nCreate Database if not exist collage;\n\n-- Drop database db_name;\ndrop database if exists db_name;\n\n-- Show Databases\nshow databases;\n\n-- Table Related Queries:\n-- Create:\n-- create table table_name(column_name1 datatype constraint, column_name2 datatype constraint);\ncreate table student(rollno int primary key, name varchar(20));\n\n-- Select And View all column:\nselect * from student;\n\n-- Insert:\nInsert into table_name(col1_v1, col2_v1), (col2_v2, col2_v2);\n\n-- Practice Questions:\ncreate table xyz_company;\nuse xyz_company;\ncreate table employee(id int primary key, name varchar(20), salary int);\ninsert into employee values(101, \"adam\", 25000),(2, \"bob\", 30000),(103, \"casey\", 40000);\nselect * from employee;\n\n-- Keys:\n-- Primary Keys:\n-- It is a column (or set of columns) in a table that uniquely identifies each row. (a unique id)\n-- Thereis only 1Pk \u0026 it Should be Not Null.\n\n-- Foreign Key:\n-- A Foreign key is a column (or set of columns) in a table that refers to the rpimary key in another table.\n-- there can be multiple FK's.\n-- FK's can have duplicate \u0026 null values.\n\n-- Constraints:\n-- SQl commands are used to specify rues for data in a table.\n\n-- Not Null: Column cannot have  a null vaue\ncol1 int not null\n\n-- Unique: all values in column are diffrent.\ncol2 int unique\n\n-- primary key: makesa column unique \u0026 not null but used only for one.\n-- id int primary key\ncreate table temp(id int not null, primary key(id));\n\n-- Foreign key: Prevent actions that would destroy links between tables \ncreate table temp(cust_id int, foreign key(cust_id) references customer(id));\n\n-- Default: Sets the Default Value of a Column.\nsalary int default 25000\n\n-- Check: It can Limit the values allowed in a column\ncreate table city(id int primary key, city varchar(20), age int, constraint age_check check (age\u003e=18 and city = \"Delhi\"));\ncreate table newTab(age int check(age \u003e= 18));\n\n-- Create a Sample Table:\ncreate database college;\nuse collage;\ncreate table student(rollno int primary key, name varchar(20), marks int not null, grade char, city varchar(20));\n-- Insert this Data:\ninsert into student\n(rollno, name, marks, grade, city) \nvalues\n(101, \"Anil\", 78, \"B\", \"Pune\"),\n(102, \"Rohan\", 80, \"A\", \"Mumbai\"),\n(103, \"Kranti\", 58, \"C\", \"Nagar\"),\n(104, \"Khushi\", 39, \"D\", \"Pune\"),\n(105, \"Nikita\", 50, \"C\", \"Bhivandi\");\n\n-- 28|11|24 APANA COLLAGE\n-- select: use to select data from the database\nselect * from student;\nselect name marks from student;\nselect distinct city from student;\n-- clauses: condition\n-- where clause: to define some conditions\nselect * from student where marks \u003e 80;\nselect * from student where city = \"Mumbai\";\nselect * from student where marks \u003e 80 and city = \"Mumbai\";\n-- operators: using operators in where\n-- arithmatic: +  -  *  /  %  \n-- comparison: =  !=  \u003c  \u003e  \u003c=  \u003e=\n-- logical: and or not in between all like any \n-- bitwise: \u0026 |\nselect * from student where marks \u003e 30; \nselect * from student where name = \"Pratik\";\n-- and: to check for both conditions to be true \nselect * from student where marks \u003e 80 and city = \"Mumbai\";\n-- or: to check for one of the condition to be true\nselect * from student where marks \u003e 90 or city = \"Mumbai\";\n-- between: select for a given range: inclusive values: also 80 marks and 90 marks members included\nselect * from student where marks between 80 and 90;\n-- in: matches any value in the list\nselect * from student where city in (\"Delhi\",\"Mumbai\");\n-- not: to negate condition\nselect * from student where city not in (\"Delhi\",\"Mumbai\"); \n-- limit: sets an upper limit on number of (tuples) rows to be returned\nselect * from student where marks \u003e 90 limit 3;\n-- order by: to sort in assending(asc) order or decending(desc) order\nselect * from student order by city desc;\nselect * from student order by city desc limit 3;\n-- aggregate functions: aggreate functions perform a calculations on a set of values, and return a single value.\n-- count(): count numbers\nselect count(name) from student; \n-- max(): get maximum values\nselect max(marks) from student;\n-- min(): get minimum values\nselect min(marks) from student;\n-- sum: get sum of values\nselect sum(marks) from student;\n-- avg(): get average of values\nselect avg(marks) from student;\n-- group by clause\nselect city, count(rollno) from student group by city;\nselect city, name, count(rollno) from student group by city, name;\nselect city, avg(marks) from student group by city order by city, ;\nselect city, avg(marks) from student group by city order by avg(marks);\nselect city, avg(marks) from student group by city order by avg(marks) desc;\nselect mode, count(customer) from payment group  by mode;\nselect grade, count(rollno) from student group by grade order by grade;\n-- having clause: simmilar to where i.e. applies some condition on rows.\n-- used when we we want to apply any *condition after grouping*. \n-- where: rows\n-- having: groups\nselect city, count(rollno) from student group by city having max(marks)\u003e90;\n\n-- general order:\nselect columns\nfrom table\nwhere condition\ngroup by columns\nhaving condition \norder by columns asc;\nselect city from student where grade = \"A\" group by city having max(marks) \u003e= 90 order by marks asc;\n\n-- table related Queries:\n-- update: to update existing rows\nupdate student set grade = \"0\" where grade = \"A\";\nset sql_safe_updates = 0;\nupdate student set marks = 80 where rollno = 105;       \nupdate student set grade = \"B\" where marks = 80 between 90; \nupdate student set marks = marks+1;\n-- delete: to delete some existing rows\ndelete from student where marks \u003c 33; \ndelete from student; -- all data removed.\n\n-- foreign key:\nconstraint std_fk1 foreign key(id) references stident(id);\n\n-- 01|12|24 APANA COLLAGE\nuse mydb;\nshow tables;\nselect * from student;\n\ncreate table dept(\nid int primary key,\nname varchar(20)\n);\n\ninsert into dept\n(id, name)\nvalues\n(101, \"english\"),\n(102, \"IT\");\n\nselect * from dept;\n\nupdate dept \nset id = 103\nwhere id = 102;\n\n\ncreate table teacher(\nid int primary key,\nname varchar(20),\ndeptid int,\nforeign key (deptid) references dept(id)\n);\n\ninsert into teacher\n(id, name, deptid)\nvalues\n(1001, \"Adam\", 101),\n(1002, \"BOb\", 102);\n\nselect * from teacher;\n\nupdate teacher \nset name = \"Bob\"\nwhere id = \"1002\";\n\ndrop table teacher;\n\ncreate table teacher(\nid int primary key,\nname varchar(20),\ndeptid int,\nforeign key (deptid) references dept(id)\non update cascade\non delete cascade\n);\n\ndesc dept;\ndesc teacher;\n\n-- cascading for foreign key\n\n-- on update cascade\n-- when we create a foreign key using this option, it deleteshe referenceing row  in the child table when the referenced row is deleted in the parent table which has a primary key.\n\n-- on delete cascade\n-- when we create  a foreign key using update cascade the referencing rows are updated in the child table when the reference row is updated in the parent table which has a primary key.\n\n-- table related queries: \n-- Alter(to change  the schema | design ):\n\n-- ADD column:\n-- alter table table_name add column column_name datatype constraint;\n\n-- Drop Column:\n-- alter table table_name drop column column_name;\n\n-- RENAME column:\n-- alter table table_name rename to new table_name;\n\n-- CHANGE column (rename):\n-- alter table table_name change column new_name new_datatye new_constraints;\n\n-- MODIFY Column:\n -- alter table table_name modify col_name new _datatype new_constraints;\n\nselect * from student;\n\nalter table student\nadd column grade varchar(20) not null default \"C\";  \n\nalter table student\ndrop column  grade;\n\nalter table student\nrename to grades;\n\nalter table grades\nrename to student;\t\n\nalter table student\nchange column grade grd varchar(20);\n \n alter table student \n modify grd char not null;\n \n desc student;\n \n -- table related queries:\n -- Truncate (to delete table's data)\n \n -- truncate table table_name;\n truncate table student;\n \n update student \n set grd = \"A\"\n where grd = \"C\";\n -- Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.  To disable safe mode, toggle the option in Preferences -\u003e SQL Editor and reconnect.\n\n-- Practice Questions:\nselect * from student;\n-- a. Change the name of column \"name\" to \"full_name\".\nalter table student\nchange column name full_name varchar(20);\n-- b. delete all the student who scored marks less than 80.alter\ndelete from student \nwhere marks\u003c30;\n-- Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.  To disable safe mode, toggle the option in Preferences -\u003e SQL Editor and reconnect.\n-- c. delete the column for garade.\nalter table student \ndrop column grd;\n\n-- joins in sql:\n-- joins used to combine rows from two or more tables, based on a related columns between them.\n\n-- Inner join \n-- Outer join - Left join, Right join, Full join\n \n-- Inner join:\n-- Returns record that have matching values in both tables.\n-- select columns from tableA inner join tableB on tableA.col_name = tableB.col_name;\n\ncreate database collage;\nuse collage;\n\ncreate table student(\nid int primary key,\nname varchar(20)\n);\n\ninsert into student\n(id, name)\nvalues\n(101, \"Adam\"),\n(102, \"Bob\"),\n(103, \"Casey\");\n\ncreate table course(\nid int primary key,\ncourse varchar(20)\n);\n\ninsert into  course\n(id, course)\nvalues \n(102, \"English\"),\n(105, \"Math\"),\n(103, \"Science\"),\n(107, \"Computer Science\");\n\nselect * from student;\nselect * from course;\n\nselect * from student\ninner join course\non student.id = course.id;\n\nselect * from student as s\ninner join course as c\non s.id = c.id;\n\n-- Left Join:\n-- Returns all records from the left table, and the matching record from the right tabe\n-- select columns from tableA left join tableB on tableA.col_name = tableB.col_name;\nselect * from student left join course on student.id = course.id; \n\n-- Right Join:\n-- Returns all record from the right table, and the matching record from the right table\n-- select columns from tableA right join tableB on tableA.col_name = tableB.col_name;\nselect * from student right join course on student.id = course.id;\n\n-- Full Join | Full Outer join | Union : Full join not present in mysql it uses union, but present in oracle and postgrey.\n-- Returns all record when there is a match in either left or right table.\nselect * from student as a left join course as b on a.id = b.id union select * from student as a right join course as b on a.id = b.id;\n\n-- Think \u0026 Ans:\n-- Right Exclusive join:\nselect * from student right join course on  student.id = course.id where student.id is null;\n-- Left Exclusive join:\nselect * from student left join course on  student.id = course.id where course.id is null;\n\n-- Self Join:\n-- It is regular join but the table is joined with itself.alter\n-- select columns from tableA as a join tableA as b on a.col_name = b.col_name;\nselect a.name as manager_name, b.name from employee as a join employee as b on a.id = b.manager_id;\n\ncreate table employee(\nid int primary key,\nname varchar(20),\nmanager_id int\n);\n\ninsert into employee (id, name, manager_id)\nvalues\n(101, \"adam\", 103),\n(102, \"bob\", 104),\n(103, \"casey\", null),\n(104, \"donald\", 103);\n-- Error Code: 1062. Duplicate entry '101' for key 'employee.PRIMARY'\n\nselect * from employee; \n\nselect * from employee as a join employee as b on a.id = b.manager_id; \nselect a.name, b.name from employee as a join employee as b on a.id = b.manager_id; \nselect a.name as manager_name, b.name from employee as a join employee as b on a.id = b.manager_id; \n\n-- 02|11|24 APANA COLLAGE\n-- Union | Mosty use to perform Full Join:\n-- It is used to complete the result-set of two or more select statement. Gives Unique records.alter\n\n-- To use it:\n-- every select should have same no. of columns\n-- columns must have similar data types\n-- columns in every sellect should be in same order.\n\n-- select column(s) from tableA union select column(s) from tableB\n\n-- SubQueries |InnerQueries | NestedQueries\n-- A subqueries oe inner queries or a nested queries is a query within another sql query.\n-- It involves 2 select statement.\n-- Query - SubQuery - Query depend on subquery \n-- select column(s) from table_name where col_name operator (subquery);\n\n-- SQL Sub Queries\n-- Example\n-- Get names of all students who scored more than class average.\n-- step1: find the avg of class.\n-- step2: find the names of student with marks \u003e avg.\n\nuse mydb;\nselect * from student;\nselect marks from student;\nselect avg(marks) from student; \nselect full_name, marks from student where marks \u003e 73.33;\nselect full_name, marks from student where marks \u003e (select avg(marks) from student);\n\n--  find the name of all students with even roll no.\n-- step1: Find the even roll numbers.\n-- step2: Find the names of student with even roll no.\n\nselect * from student;\nselect * from student where id%2 = 0;\nselect full_name from student where id in (select id from student where id % 2 = 0);\n\n-- SQL Sub Queries:\n-- Example with From\n-- Find  the max marks from the student of Delhi\n-- step1: Find the student of Delhi.\n-- step2: Find the max marks using the sublist in step 1.\n\nselect * from student;\nalter table student add column city varchar(20) not null default \"Delhi\";\nselect * from student where city = \"Delhi\";\nselect max(marks) from (select * from student where city = \"Delhi\") as temp;\n\n-- SQL Sub Queries:\n-- Example with select\nselect (select max(marks) from student), full_name from student;\n\n-- MySql Views:\n-- A view is a virtual table based on the result-set of an sql statement.\n-- A view always shows up to date data. the database engine recreates the view, every time a user queries it.\n-- table - real - real data - operations.\n-- view - virtual \n\ncreate view view1 as select id, full_name from student;\nselect * from view1;\nselect * from view1 where id = 8;\ndrop view view1;\n\n```\n\n```sql \n-- 18|11|2024 SMIT\n-- ED_RECORD:\nshow databases;\nuse mysql;\ncreate table ED_RECORD\n(ID int, NAME varchar(20), JOB varchar(20), SALARY int, COMM int, DEPTNO int);\ninsert into ED_RECORD values(101,\"SURESH\",\"MANAGER\",100000,5000,20);\nselect * from ED_RECORD;\ninsert into ED_RECORD values(102,\"ROHIT\",\"SALES\",100000,5000,20);\ninsert into ED_RECORD values(103,\"SUNITA\",\"QUALITY\",70000,3000,20);\ninsert into ED_RECORD values(104,\"GAURI\",\"OPERATIONS\",80000,3500,20);\ninsert into ED_RECORD values(105,\"SHRUTIKA\",\"MANAGER\",150000,4500,10);\ninsert into ED_RECORD values(106,\"SAHIL\",\"SALES\",130000,3500,10);\ninsert into ED_RECORD values(107,\"SHALAKA\",\"QUALITY\",64000,3500,10);\ninsert into ED_RECORD values(108,\"MOHSIN\",\"OPERATIONS\",55000,2500,10);\ninsert into ED_RECORD values(109,\"JEET\",\"MANAGER\",155000,4500,30);\ninsert into ED_RECORD values(109,\"JEET\",\"MANAGER\",155000,4500,30);\ninsert into ED_RECORD values(110,\"YOGESH\",\"SALES\",90000,3500,30);\ninsert into ED_RECORD values(111,\"SMRUTI\",\"QUALITY\",55000,2500,30);\ninsert into ED_RECORD values(112,\"PAYAL\",\"OPERATIONS\",72000,1500,30);\ninsert into ED_RECORD values(113,\"SWAPNIL\",\"MANAGER\",97000,3200,40);\ninsert into ED_RECORD values(114,\"SHIRIN\",\"SALES\",50000,1500,40);\ninsert into ED_RECORD values(115,\"SOHAIL\",\"QUALITY\",50000,2540,40);\ninsert into ED_RECORD values(116,\"SURAJ\",\"OPERATIONS\",83000,2700,40);\ninsert into ED_RECORD values(117,\"GILL\",\"SALES\",34000,NULL,50);\ninsert into ED_RECORD values(118,\"SAURABH\",\"OPERATIONS\",41200,0,50);\ninsert into ED_RECORD values(119,\"ASHISH\",\"MANAGER\",53470,3700,60);\n\n```\n\n\u003c!-- Add Clause in sql --\u003e\n\u003c!-- Add operators in sql --\u003e\n\n```sql\n-- 21|11|24 SMIT\n-- Dual Functions Like Operator\n-- Dual Functions use Dual Schema:\nuse mysql;\n\n-- Lpad \u0026 Rpad Dual Functions:\nselect lpad(\"code\",8,'@');\nselect lpad(\"max\",8,'*');\nselect rpad ( lpad(\"apple\",9,'$'),12,'#');\nselect rpad ( lpad(\"bye\",6,'*'),10,'$');\nselect rpad ( lpad(\"data\",7,'#'),10,'\u0026');\nselect rpad ( lpad(\"code\",8,'@'),10,'$');\nselect rpad(name,10,'$') from ED_RECORD;\nselect rpad(name,10,'#'), lpad(job,10,'@') from ED_RECORD;\n\n-- Nested Lpad \u0026 Rpad Functions: rpad(lpad(\"code\",9,\"@\"),15,\"#\");\nselect rpad(lpad(\"code\",9,\"@\"),15,\"#\");\n+---------------------------------+\n| rpad(lpad(\"code\",9,\"@\"),15,\"#\") |\n+---------------------------------+\n| @@@@@code######                 |\n+---------------------------------+\n\n-- Upper \u0026 Lower:\nselect lower(\"ABCD\") from dual;\nselect upper(\"ABCD\") from dual;\nselect upper(\"name\") from dual;\nselect lower(name), lower(job) from ED_RECORD;\n\n-- Round:\nselect round (2.8) from dual;\nselect round (2.3) from dual;\nselect round (-2.3) from dual;\nselect round (-2.8) from dual;\nselect avg(SALARY) from ED_RECORD;\nselect round(avg(SALARY)) from ED_RECORD;\n\n-- Ceil \u0026 Floor:\nselect ceil(2.1);\nselect ceil(2.8);\nselect floor(2.8);\nselect floor(2.9);\nselect ceil(-2.9);\nselect ceil(-9.9);\nselect floor(-9.9);\n\n-- Reverse:\nselect reverse(\"coding\");\nselect reverse(\"1234567890\");\n\n-- Substring:\nselect substr(\"vishkhapattanum\",1);\nselect substr(\"vishkhapattanum\",-1);\nselect substr(\"vishkhapattanum\",1,5);\nselect substr(\"vishkhapattanum\",1,length(\"vishakhapattanum\")/2);\nselect substr(\"Pratik\",1,length(\"Pratik\")/2);\nselect substr(\"Pratik\",-length(\"Pratik\")/2);\nselect substr(\"Pratik\",length(\"Pratik\")/2);\nselect substr(\"Pratik\",length(\"Pratik\")/2+1);\n\n-- Length\nselect length(\"VISHAKHPATTANAM\") from dual;\nselect length(name), length(job) from ED_RECORD;    \nselect length (\"name\")/2;\nselect substr(name,length(name)/2+1), substr(job,-length(job)/2) from ED_RECORD;\nselect substr(name,length(name)/2), substr(job,-length(job)/2) from ED_RECORD;\n\n-- Like Operator:\nselect name from ED_RECORD where name like \"A%\";\nselect name from ED_RECORD where name like \"S%\";\nselect name from ED_RECORD where name like \"%A\";\nselect name from ED_RECORD where name like \"____\";\nselect name from ED_RECORD where name like \"_H%\";\n\n-- Two Consicutive EE:\nselect name from ED_RECORD where name like \"%EE%\";\n\u003c!-- Two escape charecters in Dual Functions: (they dosen't print on terminal) = % \u0026 __ --\u003e\n\n```\n\n```sql \n-- 25|11|24 SMIT\n-- Date \u0026 Time\nselect sysdate();\n2024-11-25 16:32:47\nselect date(\"2024-11-25\");\n2024-11-25\nselect month(\"2024-11-25\");\n11\nselect year(\"2024-11-25\");\n2024\nselect quarter(\"2024-11-2\");\n1\nselect microsecond(\"2024-2-25 11:12:33.54321\");\n543210\nselect dayofmonth(\"2024-2-25\");\n25\nselect dayname(\"2024-11-25\");\nMonday\nselect dayofweek(\"2024-11-25\");\n2 - Monday\nselect dayofyear(\"2024-11-25\");\n330\nselect week(\"2024-11-25\");\n47\nselect yearweek(\"2024-11-25\");\n202447\nselect last_day(\"2024-11-25\");\n2024-11-30\nselect extract(year_month from (\"2024-11-25\"));\n202411\nselect extract(week from (\"2024-11-25\"));\n47\nselect extract(month from (\"2024-11-25\"));\n11\nselect extract(month from (\"2024-11-2\"));\n11\nselect extract(month from (\"2024-1-2\"));\n1\nselect extract(month from (\"2024-11-25\"));\n11\nselect extract(year from (\"2024-11-25\"));\n2024\nselect extract(hour from (\"2024-11-25 12:23:22\"));\n12\nselect extract(day from (\"2024-11-25\"));\n25\nselect extract(minute from (\"2024-11-25 12:23:22\"));\n23\nselect extract(second from (\"2024-11-25 12:23:22\"));\n22\nselect extract(microsecond from (\"2024-11-25 12:23:22.999999\"));\n999999\nselect curtime();\n17:06:09\nselect curtime(4);\n17:06:12.3775\nselect curtime(6);\n17:06:18.044820\n\n-- Group\nselect DEPTNO from ED_RECORD;\n+--------+\n| DEPTNO |\n+--------+\n|     20 |\n|     20 |\n|     20 |\n|     20 |\n|     10 |\n|     10 |\n|     10 |\n|     10 |\n|     30 |\n|     30 |\n|     30 |\n|     30 |\n|     30 |\n|     40 |\n|     40 |\n|     40 |\n|     40 |\n|     50 |\n|     50 |\n|     60 |\n+--------+\nselect DEPTNO from ED_RECORD group by DEPTNO;\n+--------+\n| DEPTNO |\n+--------+\n|     20 |\n|     10 |\n|     30 |\n|     40 |\n|     50 |\n|     60 |\n+--------+\nselect JOB from ED_RECORD group by JOB;\n+------------+\n| JOB        |\n+------------+\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n+------------+\nselect count(ID), DEPTNO from ED_RECORD group by DEPTNO;\n+-----------+--------+\n| count(ID) | DEPTNO |\n+-----------+--------+\n|         4 |     20 |\n|         4 |     10 |\n|         5 |     30 |\n|         4 |     40 |\n|         2 |     50 |\n|         1 |     60 |\n+-----------+--------+\nselect max(SALARY), DEPTNO from ED_RECORD group by DEPTNO;\n+-------------+--------+\n| max(SALARY) | DEPTNO |\n+-------------+--------+\n|      100000 |     20 |\n|      150000 |     10 |\n|      155000 |     30 |\n|       97000 |     40 |\n|       41200 |     50 |\n|       53470 |     60 |\n+-------------+--------+\nselect min(COMM), DEPTNO from ED_RECORD group by DEPTNO;\n+-----------+--------+\n| min(COMM) | DEPTNO |\n+-----------+--------+\n|      3000 |     20 |\n|      2500 |     10 |\n|      1500 |     30 |\n|      1500 |     40 |\n|         0 |     50 |\n|      3700 |     60 |\n+-----------+--------+\nselect * from ED_RECORD;\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |\n|  115 | SOHAIL   | QUALITY    |  50000 | 2540 |     40 |\n|  116 | SURAJ    | OPERATIONS |  83000 | 2700 |     40 |\n|  117 | GILL     | SALES      |  34000 | NULL |     50 |\n|  118 | SAURABH  | OPERATIONS |  41200 |    0 |     50 |\n|  119 | ASHISH   | MANAGER    |  53470 | 3700 |     60 |\n+------+----------+------------+--------+------+--------+\nselect count(JOB), DEPTNO from ED_RECORD group by DEPTNO;\n+------------+--------+\n| count(JOB) | DEPTNO |\n+------------+--------+\n|          4 |     20 |\n|          4 |     10 |\n|          5 |     30 |\n|          4 |     40 |\n|          2 |     50 |\n|          1 |     60 |\n+------------+--------+\nselect count(SALARY), DEPTNO from ED_RECORD group by DEPTNO;\n+---------------+--------+\n| count(SALARY) | DEPTNO |\n+---------------+--------+\n|             4 |     20 |\n|             4 |     10 |\n|             5 |     30 |\n|             4 |     40 |\n|             2 |     50 |\n|             1 |     60 |\n+---------------+--------+\nselect count(DEPTNO), JOB from ED_RECORD group by JOB;\n+---------------+------------+\n| count(deptno) | job        |\n+---------------+------------+\n|             6 | MANAGER    |\n|             5 | SALES      |\n|             4 | QUALITY    |\n|             5 | OPERATIONS |\n+---------------+------------+\n\n```\n\n```sql\n-- 27|11|24 - FG\n-- DDL\n-- create database\ncreate database sqlsession;\n\n-- use database\nuse sqlsession;\n\n-- create table student\ncreate table student(\nid int primary key,\nname varchar(20) not null,\nlocation varchar(20) default 'pune',\nage int check(age\u003e=18),\ncontact bigint,\ndob date\n);\n\n-- show database\nshow databases;\n\n-- show tables\nshow tables;\n\n-- desc table\ndesc student;\n\n-- describe table\ndescribe result;\n\n-- create table result\ncreate table result(\nrid int,\nrmarks int,\nispass char,\nid int,\nconstraint student_fk foreign key(id) references student(id)\n);\n\n-- alter  \n-- add col\nalter table result add rname varchar(20); \nalter table result add rname int;\n\n-- drop col\nalter table result drop column rname;\n\n-- modify datatype\nalter table result modify rname varchar(20);\n\n-- add constraint\nalter table result add constraint primary key(id);\nuse mydb;\ninsert into student(name, age, marks) values(\"Pratik\", 23, 95.5);\nselect * from student;  \nDELETE FROM student\nWHERE id = 2;\n\nCREATE TABLE department (\n    department_id DECIMAL(10, 0) PRIMARY KEY,\n    department_name VARCHAR(50) NOT NULL\n);\n\ndrop table department;\n\nCREATE TABLE employee (\n    emp_id DECIMAL(10, 0) PRIMARY KEY,\n    first_name VARCHAR(30),\n    last_name VARCHAR(30) NOT NULL,\n    email VARCHAR(30) NOT NULL,\n    phone_no VARCHAR(42),\n    hire_date DATE NOT NULL,\n    job_id VARCHAR(20),\n    salary DECIMAL(10, 0),\n    comm DECIMAL(10, 0),\n    manager_id DECIMAL(10, 0),\n    department_id DECIMAL(10, 0),\n    CONSTRAINT emp_manager_fk FOREIGN KEY (manager_id) REFERENCES employee(emp_id),\n    CONSTRAINT department_fk FOREIGN KEY (department_id) REFERENCES department(department_id)\n);\n\ndesc employee;\n\nuse mydb;\nselect * from student;\n\ncreate database lenden;\n\nuse lenden;\n\ncreate table if not exists accounts(\nid int,\naccount_no int auto_increment primary key,\nname varchar(255) not null,\nbalance double default 1000.0\n);\n\ninsert into accounts(id, account_no, name) values(1, 101, \"Ankit\");\ninsert into accounts(id, account_no, name) values(2, 102, \"Trisha\");\n\nselect * from accounts;\ntruncate table accounts;\n\ndrop table accounts;\n\n-- alter table accounts add constraint primary key(account_no);\n\nuse sqlsession;\ncreate database student;\ndrop database student;\n\ncreate database employee;\n\nuse employee;\ncreate table products(id int, name varchar(50));\nshow create table products;\n  \n-- drop primary key\nalter table products drop primary key;\n\n-- drop constraint\nalter table products drop constraint product_fk1;\n\n-- describe✅\ndesc product;\n\n-- rename✅\nrename table products to product;\n\n-- rename column✅\nalter table products rename column pame to product_name;\n\n-- DML\nuse sqlsession;\nshow tables;\ninsert into student(id, name, location, age, contact, dob) values(1, \"Pratik\", \"Pune\", 22, 1234567890, '12-01-01');\ninsert into student(id, name, location, age, contact, dob) values(2, \"Rohan\", \"Pune\", 22, 1234567890, '12-01-01');\ninsert into student(id, name, age, contact, dob) values(3, \"Rohan\", 22, 1234567890, '12-01-01');\nrename table student to students;\nalter table students rename column location to loc;\n\n-- insert into __ values\ninsert into students\n(id, name, loc, age, contact, dob)\nvalues\n(4, \"neha\", \"khed\", 22, 1234567890, '12-12-12'),\n(5, \"reva\", \"khed\", 22, 1234567890, '12-12-12');\n\ninsert into students\n(id, name, loc, age, contact, dob)\nvalues\n(6, \"sham\", \"khed\", 22, 1234567890, '12-12-12'),\n(7, \"ram\", \"khed\", 22, 1234567890, '12-12-12'),\n(8, \"raju\", \"khed\", 22, 1234567890, '12-12-12'),\n(9, \"bhim\", \"khed\", 22, 1234567890, '12-12-12');\n\ninsert into students\n(id, name, loc, age, contact, dob)\nvalues\n(10, \"khushi\", \"khed\", 22, 1234567890, '12-12-12'),\n(11, \"vicky\", \"khed\", 22, 1234567890, '12-12-12'),\n(12, \"pritty\", \"khed\", 22, 1234567890, '12-12-12'),\n(13, \"sweety\", \"khed\", 22, 1234567890, '12-12-12');\n\ninsert into students\n(id, name, loc, age, contact, dob)\nvalues\n(14, \"payal\", \"khed\", 22, 1234567890, '12-12-12'),\n(15, \"bhsma\", \"khed\", 22, 1234567890, '12-12-12'),\n(16, \"sahil\", \"khed\", 22, 1234567890, '12-12-12'),\n(17, \"samarth\", \"khed\", 22, 1234567890, '12-12-12'),\n(18, \"pallavi\", \"khed\", 22, 1234567890, '12-12-12'),\n(19, \"pragati\", \"khed\", 22, 1234567890, '12-12-12'),\n(20, \"sahil\", \"khed\", 22, 1234567890, '12-12-12');\n\n-- auto_increment\n\n-- update\nupdate students set name=\"krishna\" where id=20;\nupdate students set name=\"krishna\", loc=\"mumbai\" where id=20;\n\n\ninsert into students\n(id, name, loc, age, contact, dob)\nvalues\n(21, \"trisha\", \"khed\", 22, 1234567890, '12-12-12');\n\n-- delete from\ndelete from students where id=21;\n\n-- truncate\ntruncate table student;\n\nselect * from students;\n\ndesc students;\n\n-- DQL\nuse sqlsession;\n\n-- Insert 20 rows into the employee table\nINSERT INTO employee \n(emp_id, first_name, last_name, email, phone_no, hire_date, job_id, salary, comm, manager_id, department_id)\nVALUES\n(1, 'John', 'Doe', 'john.doe@example.com', '1234567890', '2020-01-15', 'DEV001', 50000, NULL, NULL, 10),\n(2, 'Jane', 'Smith', 'jane.smith@example.com', '1234567891', '2020-02-20', 'DEV002', 60000, 5000, 1, 20),\n(3, 'Michael', 'Brown', 'michael.brown@example.com', '1234567892', '2020-03-10', 'DEV003', 55000, 2000, 1, 30),\n(4, 'Emily', 'Davis', 'emily.davis@example.com', '1234567893', '2020-04-25', 'DEV004', 62000, NULL, 2, 20),\n(5, 'James', 'Wilson', 'james.wilson@example.com', '1234567894', '2020-05-30', 'DEV005', 48000, 1500, 2, 10),\n(6, 'Linda', 'Taylor', 'linda.taylor@example.com', '1234567895', '2020-06-15', 'DEV006', 75000, 3000, 3, 30),\n(7, 'Robert', 'Miller', 'robert.miller@example.com', '1234567896', '2020-07-10', 'DEV007', 68000, NULL, 3, 10),\n(8, 'Susan', 'Moore', 'susan.moore@example.com', '1234567897', '2020-08-05', 'DEV008', 54000, 1200, 4, 20),\n(9, 'Karen', 'Jackson', 'karen.jackson@example.com', '1234567898', '2020-09-20', 'DEV009', 63000, NULL, 5, 30),\n(10, 'Mark', 'Anderson', 'mark.anderson@example.com', '1234567899', '2020-10-01', 'DEV010', 47000, 1800, 5, 20),\n(11, 'Sarah', 'Thomas', 'sarah.thomas@example.com', '1234567800', '2020-11-12', 'DEV011', 51000, 1000, 6, 10),\n(12, 'Chris', 'Martin', 'chris.martin@example.com', '1234567801', '2021-01-15', 'DEV012', 58000, 2500, 6, 20),\n(13, 'Patricia', 'Harris', 'patricia.harris@example.com', '1234567802', '2021-02-20', 'DEV013', 49000, 900, 7, 30),\n(14, 'Daniel', 'Clark', 'daniel.clark@example.com', '1234567803', '2021-03-10', 'DEV014', 67000, 4000, 8, 10),\n(15, 'Barbara', 'Lewis', 'barbara.lewis@example.com', '1234567804', '2021-04-25', 'DEV015', 72000, NULL, 8, 20),\n(16, 'Steven', 'Walker', 'steven.walker@example.com', '1234567805', '2021-05-30', 'DEV016', 46000, 300, 9, 30),\n(17, 'Jessica', 'Allen', 'jessica.allen@example.com', '1234567806', '2021-06-15', 'DEV017', 61000, NULL, 10, 20),\n(18, 'Andrew', 'Young', 'andrew.young@example.com', '1234567807', '2021-07-10', 'DEV018', 49000, 800, 10, 10),\n(19, 'Nancy', 'King', 'nancy.king@example.com', '1234567808', '2021-08-05', 'DEV019', 56000, NULL, 11, 30),\n(20, 'Joshua', 'Wright', 'joshua.wright@example.com', '1234567809', '2021-09-20', 'DEV020', 53000, 1700, 11, 20);\n\nINSERT INTO department (department_id, department_name)\nVALUES\n(10, 'HR'),\n(20, 'Finance'),\n(30, 'IT');\n\nSELECT * FROM department;\nSELECT * FROM employee;\n\ncreate table autoincrementdemo(id int primary key auto_increment, name varchar(50));\ninsert into autoincrementdemo (name) values \n(\"Pratik\"),\n(\"Ramesh\"),\n(\"Archana\"),\n(\"Nidhi\");\nselect * from autoincrementdemo;\n\n```\n\n```sql\n-- 28|11|24 SMIT\n-- TCl\nshow databases;\nuse mysql;\ncreate table data3(id int, name varchar(20), loc varchar(20));\ninsert into data3 values(1, \"rakesh\", \"pune\");\ninsert into data3 values(2, \"Mukesh\", \"Mumbai\");\ninsert into data3 values(3, \"Rupali\", \"banglore\");\nselect * from data3;\nupdate data3 set name = \"sohan\" where id = 1;\nselect * from data3;\nupdate data3 set loc = \"channai\" where name = \"mukesh\";\nselect * from data3;\ndelete from data3 where id = 1;\nselect * from data3;\ndelete from data3 where id = \"mukesh\";\ndelete from data3 where id = 3;\nselect * from data3;\nset autocommit = 0;\nstart transaction;\ninsert into data3 values (3, \"gauri\", \"channai\");\ninsert into data3 values (4, \"shruti\", \"pune\");\nselect * from data3;\nrollback;\ninsert into data3 values (4, \"shruti\", \"pune\");\ninsert into data3 values (3, \"gauri\", \"channai\");\nselect * from data3;\ncommit;\nselect * from data3;\nrollback;\nselect * from data3;\ninsert into data3 values (5, \"Pratik\", \"Pune\");\ninsert into data3 values (6, \"Samarth\", \"Pune\");\nselect * from data3;\nsavepoint p1;\ninsert into data3 values (7, \"Rahul\", \"Pune\");\ninsert into data3 values (8, \"Lokesh\", \"Pune\");\nselect * from data3;\nsavepoint p2;\nselect * from data3;\ninsert into data3 values (9, \"yash\", \"Pune\");\ninsert into data3 values (10, \"Bhim\", \"Kanpur\");\nselect * from data3;\nrollback to p2;\nselect * from data3;\nrollback to p1;\nselect * from data3;\ncreate user pandu@localhost identified by \"jimmi\";\ngrant select on data3 to pandu@localhost;\ngrant update on data3 to pandu@localhost;\ngrant delete on data3 to pandu@localhost;\nrevoke update on data3 from pandu@localhost;\nrevoke update on data3 from pandu@localhost;\nrevoke delete on data3 from pandu@localhost;\ngrant all on data3 to pandu@localhost;\nrevoke all on data3 from pandu@localhost;\n\nC:\\Users\\majag\u003ecd C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\nC:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\u003emysql -u pandu -p\nmysql -u pandu -p\nuse mysql;\nshow databases;\nshow tables;\nselect * from data3;\nupdate data3 set name = \"sohan\" where id = 1;\nselect * from data3;\nupdate data3 set name = \"sohan\" where id = 2;\nselect * from data3;\ndelete from data3 where id = 1;\ndelete from data3 where id = 2;\nselect * from data3;\n\n```\n\n```sql\n-- 28|11|24 FG\ncreate database test;\ndrop database test;\nuse test;\n\nuse sqlsession;\nselect * from students;\nselect * from result;\ninsert into result values(101, 80, \"p\", 1);\ndelete from result where id=101;\n\ndesc students;\ndesc result;\n\n-- 28|11|24\n-- cascading: give delete permissioons on table on parent child relationship\n-- on cascade delete\n-- on cascade set null\ndrop table test1;\ndrop table test2;\n\ncreate table test2(\nid int,\nname varchar(20),\nconstraint fk1 foreign key (id) references test1(id)\n-- on delete cascade\non delete set null\n);\n\ncreate table test1(\nid int primary key,\nname varchar(20)\n);\n\ninsert into test2 values(1,\"p\");\ninsert into test2 values(2,\"ramesh\");\ninsert into test2 values(3,\"archana\");\ninsert into test2 values(4,\"pragati\");\n\ndelete from test1 where id=1;\n\nselect * from test1;\nselect * from test2;\n\ndesc test1;\ndesc test2;\n\n-- projection select all data\n-- selection use where clause\n-- distict unique values\n\nselect distict name from data1;\nselect distict name, branch from data;\n\n-- alias: as\nselect 10+5 as addition;\nselect first_name as fn from data1;\nselect first_name fn from data1;\n\n-- order by: asc desc\nselect * from employees order by salary desc;\n-- limit\nselect * from data1 limit 3;\n-- offset: skip starting values\nselect * from employee limit 10 offset 5;\nselect * from data1 limit 5,10;\n-- highest sallary top3 values\nselect salary from employee order by salary desc limit 5;\n-- 2nd highest vallue\nselect salary from employee order by salary desc limit 1,1;\nselect salary from employee order by salary desc limit 2,1;\nselect salary from employee order by salary desc limit 4,1;\n\n```\n\n```sql SMIT\n-- 28|11|24\nuse mysql;\ncreate table dept(deptno int, dname varchar(20), loc varchar(20));\ninsert into dept(deptno, dname, loc) values(10, \"mechanical\", \"mumbai\");\ninsert into dept(deptno, dname, loc) values(20, \"computer\", \"pune\");\ninsert into dept(deptno, dname, loc) values(20, \"computer\", \"pune\");\ninsert into dept(deptno, dname, loc) values(30, \"civil\", \"banglore\");\ninsert into dept(deptno, dname, loc) values(40, \"entc\", \"chennai\");\ninsert into dept(deptno, dname, loc) values(60, \"electric\", \"tamil_nadu\");\ninsert into dept(deptno, dname, loc) values(70, \"chemical\", \"panjabi\");\ninsert into dept(deptno, dname, loc) values(80, \"education\", \"karnataka\");\ninsert into dept(deptno, dname, loc) values(90, \"art\", \"rajasthan\");\nselect * from dept;\n+--------+------------+------------+\n| deptno | dname      | loc        |\n+--------+------------+------------+\n|     10 | mechanical | mumbai     |\n|     10 | mechanical | mumbai     |\n|     20 | computer   | pune       |\n|     20 | computer   | pune       |\n|     30 | civil      | banglore   |\n|     40 | entc       | chennai    |\n|     50 | it         | mp         |\n|     60 | electric   | tamil_nadu |\n|     70 | chemical   | panjabi    |\n|     80 | education  | karnataka  |\n|     90 | art        | rajasthan  |\n+--------+------------+------------+\n\n```\n\n\n```sql\nselect * from ed_record where salary = (select max(salary) from ed_record where deptno in (select deptno from dept wher dname=\"computer\");\nselect name from ed_record where deptno in (select deptno from dept where dname in (select deptno from ed_record where name =\"shalaka\")));\n```\n\n```sql\n28|11|24\nuse mysql;\ncreate table dept(deptno int, dname varchar(20), loc varchar(20));\ninsert into dept(deptno, dname, loc) values(10, \"mechanical\", \"mumbai\");\ninsert into dept(deptno, dname, loc) values(10, \"mechanical\", \"mumbai\");\ninsert into dept(deptno, dname, loc) values(20, \"computer\", \"pune\");\ninsert into dept(deptno, dname, loc) values(50, \"it\", \"mp\");\ninsert into dept(deptno, dname, loc) values(60, \"electric\", \"tamil_nadu\");\ninsert into dept(deptno, dname, loc) values(70, \"chemical\", \"panjabi\");\ninsert into dept(deptno, dname, loc) values(80, \"education\", \"karnataka\");\ninsert into dept(deptno, dname, loc) values(90, \"art\", \"rajasthan\");\nselect * from dept;\n+--------+------------+------------+\n| deptno | dname      | loc        |\n+--------+------------+------------+\n|     10 | mechanical | mumbai     |\n|     10 | mechanical | mumbai     |\n|     20 | computer   | pune       |\n|     20 | computer   | pune       |\n|     30 | civil      | banglore   |\n|     40 | entc       | chennai    |\n|     50 | it         | mp         |\n|     60 | electric   | tamil_nadu |\n|     70 | chemical   | panjabi    |\n|     80 | education  | karnataka  |\n|     90 | art        | rajasthan  |\n+--------+------------+------------+\n\nselect * from ed_record;\nselect name from ed_record where deptno in (select deptno from dept where dname like \"%c\");\nselect deptno from ed_record where name = \"swapnil\";\nselect deptno from ed_record where name = \"shirin\";\nselect * from dept;\nselect name from ed_record where deptno in (select deptno from dept where dname like \"C%\");\nselect deptno from ed_record where name = \"suresh\";\nselect name from ed_record where deptno in (select deptno from dept where dname like \"%l\");\nselect name from ed_record where deptno in (select deptno from dept where dname like \"l%\");\nselect * from dept;\nselect * from ed_record;\nselect max(salary) from ed_record;\nselect min(comm) from ed_record;\nselect deptno from ed_record where comm=0;\nselect dname from dept where deptno in (select deptno from ed_record where comm=(select min(comm) from ed_record));\nselect dname from dept where deptno in (select deptno from ed_record where salary=(select min(salary) from ed_record));\nselect select * from dept;\nselect name from ed_record where deptno in (select deptno from dept where dname = \"mechanical\");\nselect name from ed_record where name = \"gill\";\nselect * from ed_record where deptno in (select deptno from dept where loc in (select loc from dept where deptno in (select deptno from ed_record where name=\"gill\")));\n\n```\n\n# Assignment_1:\n```sql FG\n-- 29|11|24\n-- DDL Operations:\n-- Q.1. Create the above tables with appropriate data types and constraints (primary keys, foreign keys, not null, etc.).\n-- Drop database and tables:\ndrop database library_management;\ndrop table Books;\ndrop table Members;\ndrop table Borrowed_Books;\n\n-- Create database:\ncreate database library_management;\n\n-- Use database:\nuse library_management;\n\n-- Create table:\n-- Books:\ncreate table Books(\nbook_id int primary key,\ntitle varchar(20),\nauthor varchar(20),\npublication_year date,\ngenre varchar(20),\navailable_copies int\n);\n\n-- Members:\ncreate table Members(\nmember_id int primary key auto_increment,\nname varchar(20),\naddress varchar(100),\nphone_number bigint,\nmembership_start_date date,\nmembership_end_date date\n);\n\n-- Borrowed_Books:\ncreate table Borrowed_Books(\nborrow_id int primary key,\nbook_id int,\nconstraint book_id_fk foreign key (book_id) references Books(book_id),\nmember_id int,\nconstraint member_id_fk foreign key (member_id) references Members(member_id),\nborrow_date date,\ndue_date date,\nreturn_date date \n);\n\n-- Describe table:\ndesc Books;\ndesc Members;\ndesc Borrowed_Books;\n\n-- Q.2. Alter the Books table to add a new column publisher.\n-- Reference: alter table result add rname int;\nalter table Books add publisher varchar(20);\n\n-- Q.3. Drop the Borrowed_Books table.\ndrop table Borrowed_Books;\n\n-- DML Operations:\n-- Q.1. Insert 5 records into the Books table.\ninsert into Books\n(book_id, title, author, publication_year, genre, available_copies)\nvalues\n(101, \"Kill a Mockingbird\", \"Harper Lee\", '1960-12-12',\"Fiction\",5),\n(102,\"1984\",\"George Orwell\", '1949-12-12',\"Dystopian\",3),\n(103,\"The Great Gatsby\", \"F. Scott Fitzgerald\",'1925-12-12',\"Fiction\",4),\n(104,\"PridePrejudice\",\"Jane Austen\",'1813-12-12',\"Romance\",7),\n(105,\"Catcher the Rye\",\"J.D. Salinger\",'1951-12-12',\"Fiction\",2);\n\n-- Q.2. Insert 3 records into the Members table.\ninsert into Members\n(member_id, name, address, phone_number, membership_start_date, membership_end_date)\nvalues\t\n(201, \"John Doe\", \"123 Main St, Springfield\", 555-123-4567, '2023-01-01', '2024-01-01'),\n(202, \"Jane Smith\", \"456 Oak St, Metropolis\", 555-987-6543, '2023-03-15', '2024-03-15'),\n(203, \"Alice Johnson\", \"789 Pine St, Gotham City\", 555-456-7890, '2022-11-10', '2023-11-10');\n\n-- Q.3. Insert 4 records into the Borrowed_Books table.\n-- Create Borrowed_Books table:\ncreate table Borrowed_Books(\nborrow_id int primary key,\nbook_id int,\nconstraint book_id_fk foreign key (book_id) references Books(book_id),\nmember_id int,\nconstraint member_id_fk foreign key (member_id) references Members(member_id),\nborrow_date date,\ndue_date date,\nreturn_date date \n);\n\n-- Insert values in Borrowed_Books table:\ninsert into Borrowed_Books\n(borrow_id, book_id, member_id, borrow_date, due_date, return_date)\nvalues\n(301, 101, 201, '2024-11-01', '2024-11-15', '2024-11-14'),\n(302, 102, 202, '2024-11-02', '2024-11-16', '2024-11-20'),\n(303, 103, 203, '2024-11-03', '2024-11-17', '2024-11-17'),\n(304, 104, 201, '2024-11-04', '2024-11-18', '2024-11-18');\n\n-- Errors:\n-- Error Code: 1292. Incorrect date value: 'NULL' for column 'return_date' at row 3: colno-3 error: ✅\n-- Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`library_management`.`borrowed_books`, CONSTRAINT `member_id_fk` FOREIGN KEY (`member_id`) REFERENCES `members` (`member_id`)): colno-4 error: ✅\n\n-- Q.4. Update the publication_year of a specific book.\n-- update students set name=\"krishna\" where id=20;\nupdate Books set publication_year = '1970-12-12' where book_id = 101;\n\n-- Q.5. Delete a member from the Members table.\ndelete from Members where member_id = 201;\n-- Error Code: 1451. Cannot delete or update a parent row: a foreign key constraint fails (`library_management`.`borrowed_books`, CONSTRAINT `member_id_fk` FOREIGN KEY (`member_id`) REFERENCES `members` (`member_id`)) ❌-\u003e\n\n-- To fix this:\n-- step 1: drop table\ndrop table Borrowed_Books;\n\n-- step 2: crete with on delete cascade\ncreate table Borrowed_Books(\nborrow_id int primary key,\nbook_id int,\nconstraint book_id_fk foreign key (book_id) references Books(book_id),\nmember_id int,\nconstraint member_id_fk foreign key (member_id) references Members(member_id) on delete cascade,\nborrow_date date,\ndue_date date,\nreturn_date date\n);\n\n-- step 3: insert values in Borrowed_Books table:\ninsert into Borrowed_Books\n(borrow_id, book_id, member_id, borrow_date, due_date, return_date)\nvalues\n(301, 101, 201, '2024-11-01', '2024-11-15', '2024-11-14'),\n(302, 102, 202, '2024-11-02', '2024-11-16', '2024-11-20'),\n(303, 103, 203, '2024-11-03', '2024-11-17', '2024-11-17'),\n(304, 104, 201, '2024-11-04', '2024-11-18', '2024-11-18');\n\n-- step 4: delete Members\ndelete from Members where member_id = 201;\n\n-- Cascading Constraints:\n-- Q.1. Implement a cascading delete constraint on the Borrowed_Books table so that when a book is deleted, all related borrow records are also deleted automatically.\n\n-- step 1: drop table\ndrop table Borrowed_Books;\n\n-- step 2: crete with on delete cascade\ncreate table Borrowed_Books(\nborrow_id int primary key,\nbook_id int,\nconstraint book_id_fk foreign key (book_id) references Books(book_id) on delete cascade,\nmember_id int,\nconstraint member_id_fk foreign key (member_id) references Members(member_id),\nborrow_date date,\ndue_date date,\nreturn_date date\n);\n\n-- Q.3. Demonstrate the effect of this constraint by deleting a book.\n-- step 1: insert values in Borrowed_Books table:\ninsert into Borrowed_Books\n(borrow_id, book_id, member_id, borrow_date, due_date, return_date)\nvalues\n(301, 101, 201, '2024-11-01', '2024-11-15', '2024-11-14'),\n(302, 102, 202, '2024-11-02', '2024-11-16', '2024-11-20'),\n(303, 103, 203, '2024-11-03', '2024-11-17', '2024-11-17'),\n(304, 104, 201, '2024-11-04', '2024-11-18', '2024-11-18');\n\n-- step 2: delete book\ndelete from Books where book_id = 101;\n\n-- step 3: additonal work to cross check:\ninsert into Books\n(book_id, title, author, publication_year, genre, available_copies)\nvalues\n(101, \"Kill a Mockingbird\", \"Harper Lee\", '1960-12-12',\"Fiction\",5);\n\n-- Retrive data:\nselect * from Books;\nselect * from Members;\nselect * from Borrowed_Books;\n\n-- Final Output:\nshow databases;\n+--------------------+\n| Database           |\n+--------------------+\n| employee           |\n| information_schema |\n| lenden             |\n| library_management |\n| mydb               |\n| mysql              |\n| performance_schema |\n| sakila             |\n| sqlsession         |\n| sys                |\n| world              |\n+--------------------+\n\nuse library_management;\nshow tables;\n+------------------------------+\n| Tables_in_library_management |\n+------------------------------+\n| books                        |\n| borrowed_books               |\n| members                      |\n+------------------------------+\n\nselect * from books;\n+---------+------------------+---------------------+------------------+-----------+------------------+-----------+\n| book_id | title            | author              | publication_year | genre     | available_copies | publisher |\n+---------+------------------+---------------------+------------------+-----------+------------------+-----------+\n|     102 | 1984             | George Orwell       | 1949-12-12       | Dystopian |                3 | NULL      |\n|     103 | The Great Gatsby | F. Scott Fitzgerald | 1925-12-12       | Fiction   |                4 | NULL      |\n|     104 | PridePrejudice   | Jane Austen         | 1813-12-12       | Romance   |                7 | NULL      |\n|     105 | Catcher the Rye  | J.D. Salinger       | 1951-12-12       | Fiction   |                2 | NULL      |\n+---------+------------------+---------------------+------------------+-----------+------------------+-----------+\n\nselect * from members;\n+-----------+---------------+--------------------------+--------------+-----------------------+---------------------+\n| member_id | name          | address                  | phone_number | membership_start_date | membership_end_date |\n+-----------+---------------+--------------------------+--------------+-----------------------+---------------------+\n|       201 | John Doe      | 123 Main St, Springfield |        -4135 | 2023-01-01            | 2024-01-01          |\n|       202 | Jane Smith    | 456 Oak St, Metropolis   |        -6975 | 2023-03-15            | 2024-03-15          |\n|       203 | Alice Johnson | 789 Pine St, Gotham City |        -7791 | 2022-11-10            | 2023-11-10          |\n+-----------+---------------+--------------------------+--------------+-----------------------+---------------------+\n\nselect * from borrowed_books;\n+-----------+---------+-----------+-------------+------------+-------------+\n| borrow_id | book_id | member_id | borrow_date | due_date   | return_date |\n+-----------+---------+-----------+-------------+------------+-------------+\n|       302 |     102 |       202 | 2024-11-02  | 2024-11-16 | 2024-11-20  |\n|       303 |     103 |       203 | 2024-11-03  | 2024-11-17 | 2024-11-17  |\n|       304 |     104 |       201 | 2024-11-04  | 2024-11-18 | 2024-11-18  |\n+-----------+---------+-----------+-------------+------------+-------------+\n\n```\n\n```sql\n-- 29|11|24\nshow databases; \n+--------------------+\n| Database           |\n+--------------------+\n| employee           |\n| information_schema |\n| lenden             |\n| library_management |\n| mydb               |\n| mysql              |\n| performance_schema |\n| sakila             |\n| sqlsession         |\n| sys                |\n| world              |\n+--------------------+\n\nuse mysql;\n\nshow tables;\n+------------------------------------------------------+\n| Tables_in_mysql                                      |\n+------------------------------------------------------+\n| columns_priv                                         |\n| component                                            |\n| data3                                                |\n| db                                                   |\n| default_roles                                        |\n| dept                                                 |\n| ed_record                                            |\n| engine_cost                                          |\n| func                                                 |\n| general_log                                          |\n| global_grants                                        |\n| gtid_executed                                        |\n| help_category                                        |\n| help_keyword                                         |\n| help_relation                                        |\n| help_topic                                           |\n| innodb_index_stats                                   |\n| innodb_table_stats                                   |\n| ndb_binlog_index                                     |\n| password_history                                     |\n| plugin                                               |\n| procs_priv                                           |\n| proxies_priv                                         |\n| replication_asynchronous_connection_failover         |\n| replication_asynchronous_connection_failover_managed |\n| replication_group_configuration_version              |\n| replication_group_member_actions                     |\n| role_edges                                           |\n| server_cost                                          |\n| servers                                              |\n| slave_master_info                                    |\n| slave_relay_log_info                                 |\n| slave_worker_info                                    |\n| slow_log                                             |\n| tables_priv                                          |\n| time_zone                                            |\n| time_zone_leap_second                                |\n| time_zone_name                                       |\n| time_zone_transition                                 |\n| time_zone_transition_type                            |\n| user                                                 |\n+------------------------------------------------------+\n\nselect * from ed_record;\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |\n|  115 | SOHAIL   | QUALITY    |  50000 | 2540 |     40 |\n|  116 | SURAJ    | OPERATIONS |  83000 | 2700 |     40 |\n|  117 | GILL     | SALES      |  34000 | NULL |     50 |\n|  118 | SAURABH  | OPERATIONS |  41200 |    0 |     50 |\n|  119 | ASHISH   | MANAGER    |  53470 | 3700 |     60 |\n+------+----------+------------+--------+------+--------+\n\nselect * from dept;\n+--------+------------+------------+\n| deptno | dname      | loc        |\n+--------+------------+------------+\n|     10 | mechanical | mumbai     |\n|     10 | mechanical | mumbai     |\n|     20 | computer   | pune       |\n|     20 | computer   | pune       |\n|     30 | civil      | banglore   |\n|     40 | entc       | chennai    |\n|     50 | it         | mp         |\n|     60 | electric   | tamil_nadu |\n|     70 | chemical   | panjabi    |\n|     80 | education  | karnataka  |\n|     90 | art        | rajasthan  |\n+--------+------------+------------+\n\nselect * from ed_record where deptno = \"10\";\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n+------+----------+------------+--------+------+--------+\n\nselect deptno from ed_record where name = \"shrutika\";\n+--------+\n| deptno |\n+--------+\n|     10 |\n+--------+\n\nselect loc from dept where deptno in(select deptno from ed_record where name = \"shrutika\");\n+--------+\n| loc    |\n+--------+\n| mumbai |\n| mumbai |\n+--------+\n\nselect loc from dept where deptno in(select deptno from ed_record where name = \"shrutika\");\n+--------+\n| loc    |\n+--------+\n| mumbai |\n| mumbai |\n+--------+\n\nselect deptno from dept where loc in(select loc from dept where deptno in(select deptno from ed_record where name = \"shrutika\"));\n+--------+\n| deptno |\n+--------+\n|     10 |\n|     10 |\n+--------+\n\nselect * from ed_record where deptno in (select deptno from dept where loc in(select loc from dept where deptno in(select deptno from ed_record where name = \"shrutika\")));\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n+------+----------+------------+--------+------+--------+\n\nselect * from ed_record where deptno in (select deptno from dept where loc in(select loc from dept where deptno in(select deptno from ed_record where name = \"shrutika\")));\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n+------+----------+------------+--------+------+--------+\n\nselect * from ed_record where name = \"smruti\";\n+------+--------+---------+--------+------+--------+\n| ID   | NAME   | JOB     | SALARY | COMM | DEPTNO |\n+------+--------+---------+--------+------+--------+\n|  111 | SMRUTI | QUALITY |  55000 | 2500 |     30 |\n+------+--------+---------+--------+------+--------+\n\nselect * from ed_record where job != (select job from ed_record where name = \"smruti\") and salary \u003e (select salary from ed_record where name = \"rohit\");\n+------+----------+---------+--------+------+--------+\n| ID   | NAME     | JOB     | SALARY | COMM | DEPTNO |\n+------+----------+---------+--------+------+--------+\n|  105 | SHRUTIKA | MANAGER | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES   | 130000 | 3500 |     10 |\n|  109 | JEET     | MANAGER | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER | 155000 | 4500 |     30 |\n+------+----------+---------+--------+------+--------+\n\n(select salary from ed_record where name = \"saurabh\");\n+--------+\n| salary |\n+--------+\n|  41200 |\n+--------+\n\nselect * from ed_record where name = \"gauri\";\n+------+-------+------------+--------+------+--------+\n| ID   | NAME  | JOB        | SALARY | COMM | DEPTNO |\n+------+-------+------------+--------+------+--------+\n|  104 | GAURI | OPERATIONS |  80000 | 3500 |     20 |\n+------+-------+------------+--------+------+--------+\n\nselect deptno from ed_record where deptno in (select deptno from ed_record where name = \"gauri\");\n+--------+\n| deptno |\n+--------+\n|     20 |\n|     20 |\n|     20 |\n|     20 |\n+--------+\n\nselect * from dept where dname = \"computer\";\n+--------+----------+------+\n| deptno | dname    | loc  |\n+--------+----------+------+\n|     20 | computer | pune |\n|     20 | computer | pune |\n+--------+----------+------+\n\nselect * from dept where dname = \"mechanical\";\n+--------+------------+--------+\n| deptno | dname      | loc    |\n+--------+------------+--------+\n|     10 | mechanical | mumbai |\n|     10 | mechanical | mumbai |\n+--------+------------+--------+\n\nselect * from ed_record where deptno in (select deptno from dept where dname in (\"computer\", \"mechanical\"));\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n+------+----------+------------+--------+------+--------+\n\nselect * from ed_record where name = \"jeet\";\n+------+------+---------+--------+------+--------+\n| ID   | NAME | JOB     | SALARY | COMM | DEPTNO |\n+------+------+---------+--------+------+--------+\n|  109 | JEET | MANAGER | 155000 | 4500 |     30 |\n|  109 | JEET | MANAGER | 155000 | 4500 |     30 |\n+------+------+---------+--------+------+--------+\n\nselect * from ed_record where deptno in (select deptno from ed_record where name = \"jeet\");\n+------+--------+------------+--------+------+--------+\n| ID   | NAME   | JOB        | SALARY | COMM | DEPTNO |\n+------+--------+------------+--------+------+--------+\n|  109 | JEET   | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET   | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL  | OPERATIONS |  72000 | 1500 |     30 |\n+------+--------+------------+--------+------+--------+\n\nselect * from ed_record where deptno in (select deptno from dept where dname in (\"computer\", \"mechanical\"));\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n+------+----------+------------+--------+------+--------+\n\nselect * from ed_record where deptno in (select deptno from ed_record where name = \"jeet\");\n+------+--------+------------+--------+------+--------+\n| ID   | NAME   | JOB        | SALARY | COMM | DEPTNO |\n+------+--------+------------+--------+------+--------+\n|  109 | JEET   | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET   | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL  | OPERATIONS |  72000 | 1500 |     30 |\n+------+--------+------------+--------+------+--------+\n\nselect deptno from dept where dname = \"entc\";\n+--------+\n| deptno |\n+--------+\n|     40 |\n+--------+\n\nselect deptno from dept where deptno in (select deptno from dept where dname = \"entc\");\n+--------+\n| deptno |\n+--------+\n|     40 |\n+--------+\n\nselect max(salary) deptno from ed_record where deptno in (select deptno from dept where deptno in (select deptno from dept where dname = \"entc\"));\n+--------+\n| deptno |\n+--------+\n|  97000 |\n+--------+\n\nselect max(salary) from ed_record where deptno in (select deptno from dept where dname = \"entc\");\n+-------------+\n| max(salary) |\n+-------------+\n|       97000 |\n+-------------+\n\nselect min(salary) from ed_record where deptno in (select deptno from dept where dname = \"entc\");\n+-------------+\n| min(salary) |\n+-------------+\n|       50000 |\n+-------------+\n\nselect min(salary) from ed_record where deptno in (select deptno from dept where dname = \"entc\");\n+-------------+\n| min(salary) |\n+-------------+\n|       50000 |\n+-------------+\n\nselect * from  ed_record where salary in (select min(salary) from ed_record where deptno in (select deptno from dept where dname = \"entc\"));\n+------+--------+---------+--------+------+--------+\n| ID   | NAME   | JOB     | SALARY | COMM | DEPTNO |\n+------+--------+---------+--------+------+--------+\n|  114 | SHIRIN | SALES   |  50000 | 1500 |     40 |\n|  115 | SOHAIL | QUALITY |  50000 | 2540 |     40 |\n+------+--------+---------+--------+------+--------+\n\n```\n\n```sql\n-- 30|11|24\n-- ED_RECORD QUESTIONS-ANSWERS:\nshow databases;\nuse mysql;\ncreate table ED_RECORD(ID int, NAME varchar(20), JOB varchar(20), SALARY int, COMM int, DEPTNO int);\ninsert into ED_RECORD values(101,\"SURESH\",\"MANAGER\",100000,5000,20);\nselect * from ED_RECORD;\ninsert into ED_RECORD values(102,\"ROHIT\",\"SALES\",100000,5000,20);\ninsert into ED_RECORD values(103,\"SUNITA\",\"QUALITY\",70000,3000,20);\ninsert into ED_RECORD values(104,\"GAURI\",\"OPERATIONS\",80000,3500,20);\ninsert into ED_RECORD values(105,\"SHRUTIKA\",\"MANAGER\",150000,4500,10);\ninsert into ED_RECORD values(106,\"SAHIL\",\"SALES\",130000,3500,10);\ninsert into ED_RECORD values(107,\"SHALAKA\",\"QUALITY\",64000,3500,10);\ninsert into ED_RECORD values(108,\"MOHSIN\",\"OPERATIONS\",55000,2500,10);\ninsert into ED_RECORD values(109,\"JEET\",\"MANAGER\",155000,4500,30);\ninsert into ED_RECORD values(109,\"JEET\",\"MANAGER\",155000,4500,30);\ninsert into ED_RECORD values(110,\"YOGESH\",\"SALES\",90000,3500,30);\ninsert into ED_RECORD values(111,\"SMRUTI\",\"QUALITY\",55000,2500,30);\ninsert into ED_RECORD values(112,\"PAYAL\",\"OPERATIONS\",72000,1500,30);\ninsert into ED_RECORD values(113,\"SWAPNIL\",\"MANAGER\",97000,3200,40);\ninsert into ED_RECORD values(114,\"SHIRIN\",\"SALES\",50000,1500,40);\ninsert into ED_RECORD values(115,\"SOHAIL\",\"QUALITY\",50000,2540,40);\ninsert into ED_RECORD values(116,\"SURAJ\",\"OPERATIONS\",83000,2700,40);\ninsert into ED_RECORD values(117,\"GILL\",\"SALES\",34000,NULL,50);\ninsert into ED_RECORD values(118,\"SAURABH\",\"OPERATIONS\",41200,0,50);\ninsert into ED_RECORD values(119,\"ASHISH\",\"MANAGER\",53470,3700,60);\n\nselect * from ed_record;\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |\n|  115 | SOHAIL   | QUALITY    |  50000 | 2540 |     40 |\n|  116 | SURAJ    | OPERATIONS |  83000 | 2700 |     40 |\n|  117 | GILL     | SALES      |  34000 | NULL |     50 |\n|  118 | SAURABH  | OPERATIONS |  41200 |    0 |     50 |\n|  119 | ASHISH   | MANAGER    |  53470 | 3700 |     60 |\n+------+----------+------------+--------+------+--------+\n20 rows in set (0.02 sec)\n\n-- Q1: DISPLAY ALL THE RECORDS OF THE TABLE?\nselect * from ed_record;\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |\n|  115 | SOHAIL   | QUALITY    |  50000 | 2540 |     40 |\n|  116 | SURAJ    | OPERATIONS |  83000 | 2700 |     40 |\n|  117 | GILL     | SALES      |  34000 | NULL |     50 |\n|  118 | SAURABH  | OPERATIONS |  41200 |    0 |     50 |\n|  119 | ASHISH   | MANAGER    |  53470 | 3700 |     60 |\n+------+----------+------------+--------+------+--------+\n20 rows in set (0.02 sec)\n\n-- Q2.DISPLAY NAMES OF EMPLOYEES WORKING IN THE COMPANY?\nselect name from ed_record;\n+----------+\n| name     |\n+----------+\n| SURESH   |\n| ROHIT    |\n| SUNITA   |\n| GAURI    |\n| SHRUTIKA |\n| SAHIL    |\n| SHALAKA  |\n| MOHSIN   |\n| JEET     |\n| JEET     |\n| YOGESH   |\n| SMRUTI   |\n| PAYAL    |\n| SWAPNIL  |\n| SHIRIN   |\n| SOHAIL   |\n| SURAJ    |\n| GILL     |\n| SAURABH  |\n| ASHISH   |\n+----------+\n20 rows in set (0.02 sec)\n\nselect name from ed_record where salary \u003e 0;\n+----------+\n| name     |\n+----------+\n| SURESH   |\n| ROHIT    |\n| SUNITA   |\n| GAURI    |\n| SHRUTIKA |\n| SAHIL    |\n| SHALAKA  |\n| MOHSIN   |\n| JEET     |\n| JEET     |\n| YOGESH   |\n| SMRUTI   |\n| PAYAL    |\n| SWAPNIL  |\n| SHIRIN   |\n| SOHAIL   |\n| SURAJ    |\n| GILL     |\n| SAURABH  |\n| ASHISH   |\n+----------+\n\n-- Q3.DISPLAY NAME OF EMPLOYEES HAVING SALARY 34000?\nselect name from ed_record where salary = 34000;\n+------+\n| name |\n+------+\n| GILL |\n+------+\n1 row in set (0.00 sec)\n\n-- Q4.DISPLAY NAME OF EMPLOYEES WHO ARE WORKING AS MANAGER?\nselect name from ed_record where job = \"manager\";\n+----------+\n| name     |\n+----------+\n| SURESH   |\n| SHRUTIKA |\n| JEET     |\n| JEET     |\n| SWAPNIL  |\n| ASHISH   |\n+----------+\n6 rows in set (0.00 sec)\n\n-- Q5.DISPLAY ALL THE JOBS IN THE TABLE?\nselect DISTINCT job from ed_record;\n+------------+\n| job        |\n+------------+\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n+------------+\n\nselect job from ed_record;\n+------------+\n| job        |\n+------------+\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n| MANAGER    |\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n| MANAGER    |\n| SALES      |\n| QUALITY    |\n| OPERATIONS |\n| SALES      |\n| OPERATIONS |\n| MANAGER    |\n+------------+\n\n-- Q6.DISPLAY ALL THE SALARIES IN THE TABLE?\nselect DISTINCT salary from ed_record;\n+--------+\n| salary |\n+--------+\n| 100000 |\n|  70000 |\n|  80000 |\n| 150000 |\n| 130000 |\n|  64000 |\n|  55000 |\n| 155000 |\n|  90000 |\n|  72000 |\n|  97000 |\n|  50000 |\n|  83000 |\n|  34000 |\n|  41200 |\n|  53470 |\n+--------+\n16 rows in set (0.01 sec)\n\nselect salary from ed_record;\n+--------+\n| salary |\n+--------+\n| 100000 |\n| 100000 |\n|  70000 |\n|  80000 |\n| 150000 |\n| 130000 |\n|  64000 |\n|  55000 |\n| 155000 |\n| 155000 |\n|  90000 |\n|  55000 |\n|  72000 |\n|  97000 |\n|  50000 |\n|  50000 |\n|  83000 |\n|  34000 |\n|  41200 |\n|  53470 |\n+--------+\n20 rows in set (0.00 sec)\n\n-- Q7.DISPLAY ALL THE EMPLOYEES DETAILS WORKING IN DEPTNO 20?\nselect * from ed_record where deptno = 20;\n+------+--------+------------+--------+------+--------+\n| ID   | NAME   | JOB        | SALARY | COMM | DEPTNO |\n+------+--------+------------+--------+------+--------+\n|  101 | SURESH | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT  | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI  | OPERATIONS |  80000 | 3500 |     20 |\n+------+--------+------------+--------+------+--------+\n4 rows in set (0.00 sec)\n\n-- Q8.DISPLAY DETAILS OF EMPLOYEE WITH ID=116?\nselect * from ed_record where id = 116;\n+------+-------+------------+--------+------+--------+\n| ID   | NAME  | JOB        | SALARY | COMM | DEPTNO |\n+------+-------+------------+--------+------+--------+\n|  116 | SURAJ | OPERATIONS |  83000 | 2700 |     40 |\n+------+-------+------------+--------+------+--------+\n1 row in set (0.00 sec)\n\n-- Q9.DISPLAY NAME, SALARY AND JOB OF EMPLOYEE HAVING ID=109?\nselect name, salary, job from ed_record where id = 109;\n+------+--------+---------+\n| name | salary | job     |\n+------+--------+---------+\n| JEET | 155000 | MANAGER |\n| JEET | 155000 | MANAGER |\n+------+--------+---------+\n2 rows in set (0.00 sec)\n\n-- Q10.DISPLAY NAMES,JOB AND SALARY OF EMPLOYEES WHO ARE WORKING AS SALES?\nselect name, salary , job from ed_record where job = \"sales\";\n+--------+--------+-------+\n| name   | salary | job   |\n+--------+--------+-------+\n| ROHIT  | 100000 | SALES |\n| SAHIL  | 130000 | SALES |\n| YOGESH |  90000 | SALES |\n| SHIRIN |  50000 | SALES |\n| GILL   |  34000 | SALES |\n+--------+--------+-------+\n5 rows in set (0.00 sec)\n\n-- Q11.DISPLAY ALL DETAILS OF EMPLOYEE WHO EARNS COMMISION 1500?\nselect * from ed_record where comm = 1500;\n+------+--------+------------+--------+------+--------+\n| ID   | NAME   | JOB        | SALARY | COMM | DEPTNO |\n+------+--------+------------+--------+------+--------+\n|  112 | PAYAL  | OPERATIONS |  72000 | 1500 |     30 |\n|  114 | SHIRIN | SALES      |  50000 | 1500 |     40 |\n+------+--------+------------+--------+------+--------+\n2 rows in set (0.00 sec)\n\n-- Q12.DISPLAY THE SALARY AND JOB OF SMRUTI?\nselect salary, job from ed_record where name = \"smruti\";\n+--------+---------+\n| salary | job     |\n+--------+---------+\n|  55000 | QUALITY |\n+--------+---------+\n1 row in set (0.00 sec)\n\n-- Q13.DISPLAY THE MAXIMUM SALARY FROM THE TABLE?\nselect max(salary) from ed_record;\n+-------------+\n| max(salary) |\n+-------------+\n|      155000 |\n+-------------+\n1 row in set (0.02 sec)\n\n-- Q14.DISPLAY THE MINIMUM SALARY FROM THE TABLE?\nselect min(salary) from ed_record;\n+-------------+\n| min(salary) |\n+-------------+\n|       34000 |\n+-------------+\n1 row in set (0.01 sec)\n\n-- Q15.DISPLAY THE NAME OF THE EMPLOYEE WHO EARNS MAXIMUM SALARY?\nselect name from ed_record where salary = (select max(salary) from ed_record);\n+------+\n| name |\n+------+\n| JEET |\n| JEET |\n+------+\n2 rows in set (0.02 sec)\n\nselect name from ed_record order by salary desc limit 1;\n+------+\n| name |\n+------+\n| JEET |\n+------+\n1 row in set (0.00 sec)\n\nselect * from ed_record order by salary desc limit 1;\n+------+------+---------+--------+------+--------+\n| ID   | NAME | JOB     | SALARY | COMM | DEPTNO |\n+------+------+---------+--------+------+--------+\n|  109 | JEET | MANAGER | 155000 | 4500 |     30 |\n+------+------+---------+--------+------+--------+\n1 row in set (0.00 sec)\n\n-- Q16.DISPLAY THE NAME OF THE EMPLOYEE WHO EARNS MINIMUM SALARY?\nselect name from ed_record where salary = (select min(salary) from ed_record);\n+------+\n| name |\n+------+\n| GILL |\n+------+\n1 row in set (0.00 sec)\n\nselect name from ed_record order by salary limit 1;\n+------+\n| name |\n+------+\n| GILL |\n+------+\n1 row in set (0.00 sec)\n\nselect * from ed_record order by salary limit 1;\n+------+------+-------+--------+------+--------+\n| ID   | NAME | JOB   | SALARY | COMM | DEPTNO |\n+------+------+-------+--------+------+--------+\n|  117 | GILL | SALES |  34000 | NULL |     50 |\n+------+------+-------+--------+------+--------+\n1 row in set (0.01 sec)\n\n-- Q17.DISPLAY THE AVERAGE SALARY OF ALL THE EMPLOYEES?\nselect avg(salary) from ed_record;\n+-------------+\n| avg(salary) |\n+-------------+\n|  84233.5000 |\n+-------------+\n1 row in set (0.01 sec)\nselect id, avg(salary) from ed_record where salary group by id;\n+------+-------------+\n| id   | avg(salary) |\n+------+-------------+\n|  101 | 100000.0000 |\n|  102 | 100000.0000 |\n|  103 |  70000.0000 |\n|  104 |  80000.0000 |\n|  105 | 150000.0000 |\n|  106 | 130000.0000 |\n|  107 |  64000.0000 |\n|  108 |  55000.0000 |\n|  109 | 155000.0000 |\n|  110 |  90000.0000 |\n|  111 |  55000.0000 |\n|  112 |  72000.0000 |\n|  113 |  97000.0000 |\n|  114 |  50000.0000 |\n|  115 |  50000.0000 |\n|  116 |  83000.0000 |\n|  117 |  34000.0000 |\n|  118 |  41200.0000 |\n|  119 |  53470.0000 |\n+------+-------------+\n19 rows in set (0.00 sec)\n\n-- Q18.DISPPLAY THE TOTAL COSTING RQUIRED FOR THE COMPANY WITH REFERENCE TO SALARY?\nselect sum(salary) as TOTAL_COSTING_RQUIRED_FOR_THE_COMPANY from ed_record;\n+---------------------------------------+\n| TOTAL_COSTING_RQUIRED_FOR_THE_COMPANY |\n+---------------------------------------+\n|                               1684670 |\n+---------------------------------------+\n1 row in set (0.00 sec)\n\n-- Q19.DISPLAY THE TOTAL NUMBER OF EMPLOYEES WORKING IN THE COMPANY?\nselect count(id) as TOTAL_EMP from ed_record;\n+-----------+\n| TOTAL_EMP |\n+-----------+\n|        20 |\n+-----------+\n1 row in set (0.00 sec)\n\n-- Q20.CREATE A TABLE WITH ONE PRIMARY KEY, 2 UNIQUE KEYS, 1 UNIQUE KEY WITH NOTNULL AND 1 NOT NULL.\ncreate table chini(id int primary key, fname varchar(20) unique, lname varchar(20) unique, mobile bigint unique not null, email varchar(25) not null); \nshow tables;\n+------------------------------------------------------+\n| Tables_in_mysql                                      |\n+------------------------------------------------------+\n| chini                                                |\n+------------------------------------------------------+\ndesc chini;\n+--------+-------------+------+-----+---------+-------+\n| Field  | Type        | Null | Key | Default | Extra |\n+--------+-------------+------+-----+---------+-------+\n| id     | int         | NO   | PRI | NULL    |       |\n| fname  | varchar(20) | YES  | UNI | NULL    |       |\n| lname  | varchar(20) | YES  | UNI | NULL    |       |\n| mobile | bigint      | NO   | UNI | NULL    |       |\n| email  | varchar(25) | NO   |     | NULL    |       |\n+--------+-------------+------+-----+---------+-------+\n5 rows in set (0.02 sec)\n\n```\n\n```sql\n-- 30|11|24\n-- Group Function: Aggregate Function: MultiRow Function.\n-- Clause:-Rules\n-- 1.Where--\u003eCondition\n-- 2.Group By--\u003eGrouping and Returns result as per group.\nselect * from ed_record;\n+------+----------+------------+--------+------+--------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO |\n+------+----------+------------+--------+------+--------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |\n|  115 | SOHAIL   | QUALITY    |  50000 | 2540 |     40 |\n|  116 | SURAJ    | OPERATIONS |  83000 | 2700 |     40 |\n|  117 | GILL     | SALES      |  34000 | NULL |     50 |\n|  118 | SAURABH  | OPERATIONS |  41200 |    0 |     50 |\n|  119 | ASHISH   | MANAGER    |  53470 | 3700 |     60 |\n+------+----------+------------+--------+------+--------+\n20 rows in set (0.00 sec)\n\n-- Q:Display Number of employee working in deptno=20?\nSELECT COUNT(DEPTNO), deptno FROM ED_RECORD WHERE DEPTNO=20;\n+---------------+--------+\n| COUNT(DEPTNO) | deptno |\n+---------------+--------+\n|             4 |     20 |\n+---------------+--------+\n1 row in set (0.00 sec)\n\n-- Q:Display Number of employee working in deptno=10?\nSELECT COUNT(DEPTNO), deptno FROM ED_RECORD WHERE DEPTNO=10;\n+---------------+--------+\n| COUNT(DEPTNO) | deptno |\n+---------------+--------+\n|             4 |     10 |\n+---------------+--------+\n1 row in set (0.00 sec)\n\n-- Q:Display number of Employees working in each deptno?\nSELECT COUNT(DEPTNO), deptno FROM ED_RECORD group by DEPTNO;\n+---------------+--------+\n| COUNT(DEPTNO) | deptno |\n+---------------+--------+\n|             4 |     20 |\n|             4 |     10 |\n|             5 |     30 |\n|             4 |     40 |\n|             2 |     50 |\n|             1 |     60 |\n+---------------+--------+\n6 rows in set (0.00 sec)\n\n-- Q:Display jobs available in each deptno?\nSELECT COUNT(JOB),DEPTNO FROM ED_RECORD GROUP BY DEPTNO;\n+------------+--------+\n| COUNT(JOB) | DEPTNO |\n+------------+--------+\n|          4 |     20 |\n|          4 |     10 |\n|          5 |     30 |\n|          4 |     40 |\n|          2 |     50 |\n|          1 |     60 |\n+------------+--------+\n6 rows in set (0.00 sec)\n\n-- Q:Display Total Salary of each department?\nSELECT SUM(SALARY),DEPTNO FROM ED_RECORD GROUP BY DEPTNO;\n+-------------+--------+\n| SUM(SALARY) | DEPTNO |\n+-------------+--------+\n|      350000 |     20 |\n|      399000 |     10 |\n|      527000 |     30 |\n|      280000 |     40 |\n|       75200 |     50 |\n|       53470 |     60 |\n+-------------+--------+\n6 rows in set (0.00 sec)\n\n-- Q: Display the maximum salary given in each department number?\nSELECT MAX(SALARY),DEPTNO FROM ED_RECORD GROUP BY DEPTNO;\n+-------------+--------+\n| MAX(SALARY) | DEPTNO |\n+-------------+--------+\n|      100000 |     20 |\n|      150000 |     10 |\n|      155000 |     30 |\n|       97000 |     40 |\n|       41200 |     50 |\n|       53470 |     60 |\n+-------------+--------+\n\n-- Q:Display the name of the employee who is earning the maximum salary in each deptno?\n\n\n-- Q:Display the average salary in each deptno?\nSELECT AVG(SALARY),DEPTNO FROM ED_RECORD GROUP BY DEPTNO;\n+-------------+--------+\n| AVG(SALARY) | DEPTNO |\n+-------------+--------+\n|  87500.0000 |     20 |\n|  99750.0000 |     10 |\n| 105400.0000 |     30 |\n|  70000.0000 |     40 |\n|  37600.0000 |     50 |\n|  53470.0000 |     60 |\n+-------------+--------+\n6 rows in set (0.00 sec)\n\n-- Q:Display Number of employee working as Manager?\nSELECT COUNT(ID),JOB FROM ED_RECORD WHERE JOB='MANAGER';\n+-----------+---------+\n| COUNT(ID) | JOB     |\n+-----------+---------+\n|         6 | MANAGER |\n+-----------+---------+\n1 row in set (0.00 sec)\n\n-- Q:Display Number of employee working as QUALITY?\nSELECT COUNT(ID),JOB FROM ED_RECORD WHERE JOB='QUALITY';\n+-----------+---------+\n| COUNT(ID) | JOB     |\n+-----------+---------+\n|         4 | QUALITY |\n+-----------+---------+\n1 row in set (0.00 sec)\n\n-- Q:Display number of employee working in each job designation?\nSELECT COUNT(ID),JOB FROM ED_RECORD GROUP BY JOB;\n+-----------+------------+\n| COUNT(ID) | JOB        |\n+-----------+------------+\n|         6 | MANAGER    |\n|         5 | SALES      |\n|         4 | QUALITY    |\n|         5 | OPERATIONS |\n+-----------+------------+\n4 rows in set (0.00 sec)\n\n-- Q:Display number of employee in each deptno earning salary \u003e=100000?\nSELECT COUNT(ID),DEPTNO FROM ED_RECORD WHERE SALARY \u003e=100000 GROUP BY DEPTNO;\n+-----------+--------+\n| COUNT(ID) | DEPTNO |\n+-----------+--------+\n|         2 |     20 |\n|         2 |     10 |\n|         2 |     30 |\n+-----------+--------+\n3 rows in set (0.00 sec)\n\n-- Q:Display number of employee in each deptno earning salary \u003c100000?\nSELECT COUNT(ID),DEPTNO FROM ED_RECORD WHERE SALARY\u003c100000 GROUP BY DEPTNO;\n+-----------+--------+\n| COUNT(ID) | DEPTNO |\n+-----------+--------+\n|         2 |     20 |\n|         2 |     10 |\n|         3 |     30 |\n|         4 |     40 |\n|         2 |     50 |\n|         1 |     60 |\n+-----------+--------+\n6 rows in set (0.00 sec)\n\n-- Q:Display the count of employees earning \u003e=100000 in each job designation?\nSELECT COUNT(ID),JOB FROM ED_RECORD WHERE SALARY\u003e100000 GROUP BY JOB;\n+-----------+---------+\n| COUNT(ID) | JOB     |\n+-----------+---------+\n|         3 | MANAGER |\n|         1 | SALES   |\n+-----------+---------+\n2 rows in set (0.00 sec)\n\nSELECT COUNT(ID),JOB FROM ED_RECORD WHERE SALARY\u003e=100000 GROUP BY JOB;\n+-----------+---------+\n| COUNT(ID) | JOB     |\n+-----------+---------+\n|         4 | MANAGER |\n|         2 | SALES   |\n+-----------+---------+\n2 rows in set (0.00 sec) \n\n```\n\n```sql\n-- 30|11|24\nuse mysql;\nselect * from ed_record, dept;\nselect * from ed_record cross join dept;\n+------+----------+------------+--------+------+--------+--------+------------+------------+\n| ID   | NAME     | JOB        | SALARY | COMM | DEPTNO | deptno | dname      | loc        |\n+------+----------+------------+--------+------+--------+--------+------------+------------+\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     90 | art        | rajasthan  |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     80 | education  | karnataka  |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     70 | chemical   | panjabi    |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     60 | electric   | tamil_nadu |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     50 | it         | mp         |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     40 | entc       | chennai    |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     30 | civil      | banglore   |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     20 | computer   | pune       |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     20 | computer   | pune       |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     10 | mechanical | mumbai     |\n|  101 | SURESH   | MANAGER    | 100000 | 5000 |     20 |     10 | mechanical | mumbai     |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     90 | art        | rajasthan  |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     80 | education  | karnataka  |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     70 | chemical   | panjabi    |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     60 | electric   | tamil_nadu |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     50 | it         | mp         |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     40 | entc       | chennai    |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     30 | civil      | banglore   |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     20 | computer   | pune       |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     20 | computer   | pune       |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     10 | mechanical | mumbai     |\n|  102 | ROHIT    | SALES      | 100000 | 5000 |     20 |     10 | mechanical | mumbai     |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     90 | art        | rajasthan  |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     80 | education  | karnataka  |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     70 | chemical   | panjabi    |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     60 | electric   | tamil_nadu |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     50 | it         | mp         |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     40 | entc       | chennai    |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     30 | civil      | banglore   |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     20 | computer   | pune       |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     20 | computer   | pune       |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     10 | mechanical | mumbai     |\n|  103 | SUNITA   | QUALITY    |  70000 | 3000 |     20 |     10 | mechanical | mumbai     |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     90 | art        | rajasthan  |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     80 | education  | karnataka  |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     70 | chemical   | panjabi    |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     60 | electric   | tamil_nadu |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     50 | it         | mp         |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     40 | entc       | chennai    |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     30 | civil      | banglore   |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     20 | computer   | pune       |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     20 | computer   | pune       |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     10 | mechanical | mumbai     |\n|  104 | GAURI    | OPERATIONS |  80000 | 3500 |     20 |     10 | mechanical | mumbai     |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     90 | art        | rajasthan  |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     80 | education  | karnataka  |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     70 | chemical   | panjabi    |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     60 | electric   | tamil_nadu |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     50 | it         | mp         |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     40 | entc       | chennai    |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     30 | civil      | banglore   |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     20 | computer   | pune       |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     20 | computer   | pune       |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     10 | mechanical | mumbai     |\n|  105 | SHRUTIKA | MANAGER    | 150000 | 4500 |     10 |     10 | mechanical | mumbai     |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     90 | art        | rajasthan  |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     80 | education  | karnataka  |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     70 | chemical   | panjabi    |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     60 | electric   | tamil_nadu |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     50 | it         | mp         |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     40 | entc       | chennai    |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     30 | civil      | banglore   |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     20 | computer   | pune       |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     20 | computer   | pune       |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     10 | mechanical | mumbai     |\n|  106 | SAHIL    | SALES      | 130000 | 3500 |     10 |     10 | mechanical | mumbai     |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     90 | art        | rajasthan  |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     80 | education  | karnataka  |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     70 | chemical   | panjabi    |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     60 | electric   | tamil_nadu |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     50 | it         | mp         |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     40 | entc       | chennai    |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     30 | civil      | banglore   |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     20 | computer   | pune       |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     20 | computer   | pune       |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     10 | mechanical | mumbai     |\n|  107 | SHALAKA  | QUALITY    |  64000 | 3500 |     10 |     10 | mechanical | mumbai     |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     90 | art        | rajasthan  |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     80 | education  | karnataka  |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     70 | chemical   | panjabi    |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     60 | electric   | tamil_nadu |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     50 | it         | mp         |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     40 | entc       | chennai    |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     30 | civil      | banglore   |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     20 | computer   | pune       |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     20 | computer   | pune       |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     10 | mechanical | mumbai     |\n|  108 | MOHSIN   | OPERATIONS |  55000 | 2500 |     10 |     10 | mechanical | mumbai     |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     90 | art        | rajasthan  |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     80 | education  | karnataka  |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     70 | chemical   | panjabi    |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     60 | electric   | tamil_nadu |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     50 | it         | mp         |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     40 | entc       | chennai    |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     30 | civil      | banglore   |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     20 | computer   | pune       |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     20 | computer   | pune       |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     10 | mechanical | mumbai     |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     10 | mechanical | mumbai     |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     90 | art        | rajasthan  |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     80 | education  | karnataka  |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     70 | chemical   | panjabi    |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     60 | electric   | tamil_nadu |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     50 | it         | mp         |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     40 | entc       | chennai    |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     30 | civil      | banglore   |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     20 | computer   | pune       |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     20 | computer   | pune       |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     10 | mechanical | mumbai     |\n|  109 | JEET     | MANAGER    | 155000 | 4500 |     30 |     10 | mechanical | mumbai     |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     90 | art        | rajasthan  |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     80 | education  | karnataka  |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     70 | chemical   | panjabi    |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     60 | electric   | tamil_nadu |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     50 | it         | mp         |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     40 | entc       | chennai    |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     30 | civil      | banglore   |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     20 | computer   | pune       |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     20 | computer   | pune       |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     10 | mechanical | mumbai     |\n|  110 | YOGESH   | SALES      |  90000 | 3500 |     30 |     10 | mechanical | mumbai     |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     90 | art        | rajasthan  |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     80 | education  | karnataka  |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     70 | chemical   | panjabi    |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     60 | electric   | tamil_nadu |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     50 | it         | mp         |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     40 | entc       | chennai    |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     30 | civil      | banglore   |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     20 | computer   | pune       |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     20 | computer   | pune       |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     10 | mechanical | mumbai     |\n|  111 | SMRUTI   | QUALITY    |  55000 | 2500 |     30 |     10 | mechanical | mumbai     |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     90 | art        | rajasthan  |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     80 | education  | karnataka  |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     70 | chemical   | panjabi    |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     60 | electric   | tamil_nadu |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     50 | it         | mp         |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     40 | entc       | chennai    |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     30 | civil      | banglore   |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     20 | computer   | pune       |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     20 | computer   | pune       |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     10 | mechanical | mumbai     |\n|  112 | PAYAL    | OPERATIONS |  72000 | 1500 |     30 |     10 | mechanical | mumbai     |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     90 | art        | rajasthan  |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     80 | education  | karnataka  |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     70 | chemical   | panjabi    |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     60 | electric   | tamil_nadu |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     50 | it         | mp         |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     40 | entc       | chennai    |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     30 | civil      | banglore   |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     20 | computer   | pune       |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     20 | computer   | pune       |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     10 | mechanical | mumbai     |\n|  113 | SWAPNIL  | MANAGER    |  97000 | 3200 |     40 |     10 | mechanical | mumbai     |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     90 | art        | rajasthan  |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     80 | education  | karnataka  |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     70 | chemical   | panjabi    |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     60 | electric   | tamil_nadu |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     50 | it         | mp         |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     40 | entc       | chennai    |\n|  114 | SHIRIN   | SALES      |  50000 | 1500 |     40 |     30 | civil      | banglore   |\n|  114 | SHIRIN   | SALES      |  50000 |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikrameshmajage%2Fmysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratikrameshmajage%2Fmysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikrameshmajage%2Fmysql/lists"}