SSL
SSL (Secure Sockets Layer) in SQL is a security protocol used to establish encrypted and secure communication between the SQL server and the client. It uses certificates to authenticate and encrypt the data being transmitted, protecting the data from unauthorized access and eavesdropping.
Example
Output
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
Output
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
Output
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
Output
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.