PER
PER is not a recognized command or function in standard SQL (Structured Query Language). SQL is used for managing and manipulating relational databases. For accurate information, ensure to confirm the actual SQL command or function.
Example
SELECT CONCAT('MySQL', ' ', 'Example') AS CombinedString;
Output
| CombinedString ||-----------------|| MySQL Example |
Explanation
The CONCAT
function in MySQL is used to concatenate two or more strings into one string. In this example, it combines the strings ‘MySQL’ and ‘Example’ into one string ‘MySQL Example’.
Example
CREATE TABLE employees ( ID INT PRIMARY KEY, name VARCHAR (100), salary NUMERIC (10, 2));
INSERT INTO employees (ID, name, salary) VALUES (1, 'John Doe', 50000.00), (2, 'Jane Doe', 75000.00), (3, 'Alice', 60000.00), (4, 'Bob', 65000.00);
SELECT * FROM employeesWHERE salary > 60000.00;
Output
id | name | salary----+-------+--------- 2 | Jane Doe | 75000.00 4 | Bob | 65000.00(2 rows)
Explanation
In the provided SQL example, a new table “employees” is first created with three columns, namely ID, name, and salary. Four rows are then inserted into the table. The SELECT statement retrieves only the rows where the salary is greater than 60000.00. Thus, the output displays the data related to ‘Jane Doe’ and ‘Bob’, since their salaries satisfy the specified condition.
Example
CREATE TABLE Employee( EmployedID INTEGER PRIMARY KEY, Name TEXT NOT NULL, Department TEXT NOT NULL, Salary REAL NOT NULL);
INSERT INTO Employee ( EmployedID, Name, Department, Salary)VALUES (1, 'John Doe', 'Marketing', 60000), (2, 'Jane Doe', 'Sales', 65000), (3, 'Jim Hopper', 'It', 70000), (4, 'Sara Connors', 'Marketing', 75000);
SELECT Name, SalaryFROM EmployeeWHERE Department = 'Marketing';
Output
| Name | Salary ||------------|--------|| John Doe | 60000 || Sara Connors| 75000 |
Explanation
This SQL code creates a table named Employee
with four fields - EmployedID
, Name
, Department
, Salary
. It inserts four rows into the Employee
table and then selects those employees whose Department is ‘Marketing’. The output displays the Name
and Salary
of these employees.