{"id":19019604,"url":"https://github.com/valentinefernandes/mysql-assignment","last_synced_at":"2025-07-18T18:36:09.222Z","repository":{"id":62370769,"uuid":"548991167","full_name":"ValentineFernandes/MySQL-Assignment","owner":"ValentineFernandes","description":"This repository consists of sql queries based on Employee database.","archived":false,"fork":false,"pushed_at":"2022-10-11T06:31:00.000Z","size":8,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-23T05:31:39.662Z","etag":null,"topics":["assignment","database","mysql","mysql-queries","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValentineFernandes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-10T13:59:53.000Z","updated_at":"2024-06-18T00:05:56.000Z","dependencies_parsed_at":"2022-10-31T18:15:13.108Z","dependency_job_id":null,"html_url":"https://github.com/ValentineFernandes/MySQL-Assignment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ValentineFernandes/MySQL-Assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentineFernandes%2FMySQL-Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentineFernandes%2FMySQL-Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentineFernandes%2FMySQL-Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentineFernandes%2FMySQL-Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValentineFernandes","download_url":"https://codeload.github.com/ValentineFernandes/MySQL-Assignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentineFernandes%2FMySQL-Assignment/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265810364,"owners_count":23831950,"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":["assignment","database","mysql","mysql-queries","sql"],"created_at":"2024-11-08T20:13:39.218Z","updated_at":"2025-07-18T18:36:09.196Z","avatar_url":"https://github.com/ValentineFernandes.png","language":null,"readme":"\u003ch1 align=\"center\"\u003eMYSQL ASSIGNMENT\u003c/h1\u003e\n\n# CREATE DATABASE\n\n```javascript\nCREATE DATABASE testdb; \n```\n\n# SHOW EXISTING DATABASE\n\n```javascript\nSHOW CREATE DATABASE testdb; \n```\n# USE COMMAND\n\n```javascript\nUSE testdb;  \n```\n\n# CREATE TABLE EMPLOYEE\n\n```javascript\nCREATE TABLE Employee  \n(  \nEmployeeID int,  \nFirstName varchar(255),  \nLastName varchar(255),  \nEmail varchar(255),  \nAddressLine varchar(255),  \nCity varchar(255)  \n); \n```\n\n# INSERT RECORDS IN EMPLOYEE TABLE\n\n```javascript\nINSERT INTO Employee (EmployeeID, FirstName, LastName, Email, AddressLine, City)\nVALUES ('101', 'Lucas', 'Santos', 'lucassantos@gmail.com', 'Brazil', 'Sao Paulo'),\n('102', 'Carlos', 'Santiago', 'carlossantiago@gmail.com', 'Argentina', 'Buenos Aires'),\n('103', 'Emanuel', 'DaSilva', 'emanueldasilva@gmail.com', 'Brazil', 'Rio Grande do Sul'),\n('104', 'Abril', 'Rodriguez', 'abrilrodrigues@gmail.com', 'Argentina', 'Mendoza'),\n('105', 'Carolina', 'Bentresca', 'carolinabentresca@gmail.com', 'Chile', 'Concepsion'),\n('106', 'Carol', 'Santos', 'carolsantos@gmail.com', 'Chile', 'Santiago'),\n('107', 'Gabriela', 'Lopez', 'Gabrielalopez@gmail.com', 'Brazil', 'Amazonas'),\n('108', 'Michael', 'DeCarvalho', 'michaeldecarvalho@gmail.com', 'Brazil', 'Fortaleza'),\n('109', 'George', 'Spencer', 'georgespencer@gmail.com', 'United Kingdom', 'London'),\n('110', 'Christina', 'Diemert', 'christinadiemert@gmail.com', 'United States', 'California');\n```\n\n# QUERIES \n\n1. From the following table return complete information about the employees.\n\n```javascript\nSELECT * FROM Employee;\n```\n\n2. From the following table, write a SQL query to find the cities of all employees. Return city.\n\n```javascript\nSELECT City FROM Employee;\n```\n\n3. From the following table, write a SQL query to find the unique addressline of the employees. Return addressline.\n\n```javascript\nSELECT DISTINCT AddressLine \nFROM Employee;\n```\n\n4. From the following table, write a SQL query to return EmployeeID, FirstName, LastName, City and AddressLine.\n\n```javascript\nSELECT EmployeeID,\n       FirstName,\n       LastName,\n       City,\n       AddressLine\nFROM Employee;\n```\n\n5. From the following table, write a SQL query to count the number of characters except the spaces for each FirstName. Return FirstName length.\n\n```javascript\nSELECT length(trim(FirstName))\nFROM Employee;\n```\n\n6. From the following table, write a SQL query to count the number of characters except the spaces for each LastName. Return LastName length. \n\n```javascript\nSELECT length(trim(LastName))\nFROM Employee;\n```\n\n7. From the following table, write a SQL query to find the EmployeeID, FirstName, Email of all the employees.\n\n```javascript\nSELECT EmployeeID,\n       FirstName,\n       Email\nFROM Employee;\n```\n\n8. From the following table, write a SQL query to find the unique AddressLine with LastName. Return AddressLine and LastName.\n\n```javascript\nSELECT DISTINCT AddressLine, LastName\nFROM Employee;\n```\n\n9. From the following table, write a SQL query to find those employees who do not belong to AddressLine Brazil. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine NOT IN ('Brazil');\n```\n\n10. From the following table, write a SQL query to find those employees who do not belong to AddressLine Argentina. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine NOT IN ('Argentina');\n```\n\n11. From the following table, write a SQL query to find those employees who EmployeeID's are before 105. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE EmployeeID\u003c('105');\n```\n\n12. From the following table, write a SQL query to find those employees who EmployeeID's are after 105. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE EmployeeID\u003e('105');\n```\n\n13. From the following table, write a SQL query to find those employees who EmployeeID's are before or equal to 105. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE EmployeeID\u003c=('105');\n```\n\n14. From the following table, write a SQL query to find those employees who EmployeeID's are after or equal to 105. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE EmployeeID\u003e=('105');\n```\n\n15. From the following table, write a SQL query to find those employees who EmployeeID is equal to 105. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE EmployeeID=('105');\n```\n\n16. From the following table, write a SQL query to find the details of the employee ‘Carol’.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE FirstName = 'Carol';\n```\n\n17. From the following table, write a SQL query to find the FirstName of the employees whose length is six. Return employee FirstName.\n\n```javascript\nSELECT FirstName\nFROM Employee\nWHERE length(FirstName)=6;\n```\n\n18. From the following table, write a SQL query to find the details of the employee LastName ‘Santos’.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE LastName = 'Santos';\n```\n\n19. From the following table, write a SQL query to find those employees whose AddressLine is ‘Brazil’. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine = 'Brazil';\n```\n\n20. From the following table, write a SQL query to find those employees whose AddressLine is ‘Argentina’. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine = 'Argentina';\n```\n\n21. From the following table, write a SQL query to find those employees whose AddressLine are either Brazil or Argentina. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine IN ('Brazil','Argentina');\n```\n\n22. From the following table, write a SQL query to find those employees whose AddressLine are either Chile or United States. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine IN ('Chile','United States');\n```\n\n23. From the following table, write a SQL query to find those employees whose AddressLine begin's with C. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine LIKE 'C%';\n```\n\n24. From the following table, write a SQL query to find those employees whose AddressLine ends with l. Return complete information about the employees. \n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine LIKE '%l';\n```\n\n25. From the following table, write a SQL query to find those employees whose AddressLine values with 'rg' in between. Return complete information about the employees.\n\n```javascript\nSELECT *\nFROM Employee\nWHERE AddressLine LIKE '%rg%';\n```\n\n# LICENSE\nThis assignment is under \u003ca href=\"https://github.com/ValentineFernandes/MySQL-Assignment/blob/main/LICENSE\"\u003eMIT\u003c/a\u003e license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinefernandes%2Fmysql-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinefernandes%2Fmysql-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinefernandes%2Fmysql-assignment/lists"}