SSL
Example
Section titled “Example”SHOW VARIABLES LIKE '%ssl%';Output
Section titled “Output”+---------------+-------+| Variable_name | Value |+---------------+-------+| have_openssl | YES || have_ssl | YES |+---------------+-------+Explanation
Section titled “Explanation”The above SQL code checks if the MySQL server has SSL configured or not. The output ‘YES’ for both variables indicates that SSL is configured and enabled for the server.
Example
Section titled “Example”CREATE USER tech WITH PASSWORD 'password123';GRANT CONNECT ON DATABASE dbname TO tech;Output
Section titled “Output”CREATE ROLEGRANTExplanation
Section titled “Explanation”In the above example, we first create a new user named ‘tech’ with a password ‘password123’. Next, we grant this user the ‘CONNECT’ privilege on the database called ‘dbname’. This allows the user ‘tech’ to establish a connection with the database. The PostgreSQL server responses with ‘CREATE ROLE’ after the successful creation of the new user. The ‘GRANT’ response indicates that the permission granting operation completed successfully.
Example
Section titled “Example”SELECT *FROM EmployeesWHERE FirstName = 'John' AND LastName = 'Doe'Output
Section titled “Output”| EmployeeID | FirstName | LastName | JobTitle ||------------|-----------|----------|--------------|| 1 | John | Doe | Site Manager |Explanation
Section titled “Explanation”The above SQL script performs a basic query on an imaginary ‘Employees’ table to fetch the record of an employee whose first name is ‘John’ and last name is ‘Doe’. The output returns a single record based on the specified criteria.
Example
Section titled “Example”SELECT employee_id, last_name, salaryFROM employeesWHERE department_id = 30;Output
Section titled “Output”EMPLOYEE_ID | LAST_NAME | SALARY------------|-----------|--------114 | Raphaely | 11000115 | Khoo | 3100116 | Baida | 2900117 | Tobias | 2800118 | Himuro | 2600119 | Colmeres | 2500Explanation
Section titled “Explanation”This SQL statement selects the columns employee_id, last_name, and salary from the employees table for those records where the department_id is 30.