The organization is striving to enhance the security of their system. The assigned responsibility entails ensuring the system's safety, conducting investigations into potential security issues, and making necessary updates to employee computers. The subsequent steps demonstrate the utilization of SQL with filters to carry out security-related tasks.
- MySQL
- SQL
- Command-line Interface
The provided screenshot consists of two parts: the query and a portion of the output. Initially, all data from the log_in_attempts table is selected. Subsequently, it narrow down the results to only include unsuccessful login attempts outside business hours
A suspicious event was identified on the date 2024-05-09. As part of the investigation, it is necessary to examine all login activity that transpired on 2024-05-09 and the preceding day. The subsequent code exemplifies the creation of a SQL query to filter and identify login attempts that occurred on the specified dates.
The provided screenshot consists of two parts: the query and a portion of the output. The query aims to retrieve all login attempts that transpired on either 2024-05-09 .
Initially, all data from the log_in_attempts table is selected. Subsequently, a WHERE clause with an OR operator is utilized to filter the results and display only login attempts that occurred on either 2024-05-09 or 2024-05-08.
The first condition, login_date = '2024-05-09', ensures that login attempts on 2024-05-09 are included in the output. Similarly, the second condition, login_date = '2024-05-08', filters for login attempts on 2024-05-08.
The screenshot provided contains two parts: the query and a segment of the output. The query aims to retrieve all login attempts that transpired in countries other than Mexico.
The process begins by selecting all data from the log_in_attempts table. Subsequently, a WHERE clause with the NOT operator is utilized to filter the results and exclude login attempts originating from Mexico. To achieve this, the LIKE operator is used, with the pattern '!= MX' employed to match the country codes representing Mexico in the dataset, namely 'MX' and 'MEXICO'.
As a result, the query returns login attempts that occurred in countries other than Mexico based on the applied filtering criteria.
The provided screenshot includes two parts: the query and a subset of the output. The query focuses on retrieving information about employees who belong to the Marketing department in the East building.
The query begins by selecting all data from the employees table. Next, a WHERE clause with the AND operator is employed to filter the results. The first condition, department = 'Marketing', ensures that only employees from the Marketing department are included. The second condition, office LIKE 'East%', uses the LIKE operator with the pattern 'East%' to match the office column entries representing the East building (e.g., East 1, East 2).
Consequently, the query returns information about employees who meet both criteria: being part of the Marketing department and working in the East building.
In the screenshot provided, the first part demonstrates your query, while the second part showcases a subset of the output. This query aims to retrieve information on employees in the Finance and Sales departments.
The query starts by selecting all data from the employees table. Next, a WHERE clause with the OR operator is used to filter the results. The reason for using OR instead of AND is to include all employees who belong to either the Finance or Sales department. The first condition, department = 'Finance', filters for employees in the Finance department, while the second condition, department = 'Sales', filters for employees in the Sales department.
As a result, the query returns all employees from the Finance and Sales departments based on the applied filtering criteria.
The provided screenshot consists of two parts: the query and a segment of the output. The query aims to retrieve all employees who are not part of the Information Technology department.
To achieve this, the query begins by selecting all data from the employees table. Subsequently, a WHERE clause with the NOT operator is utilized to filter the results and exclude employees belonging to the Information Technology department.
As a result, the query returns information about employees who are not part of the Information Technology department, based on the applied filtering criteria.





