OPTIONALLY
Example
Section titled “Example”SELECT * FROM EmployeesOutput
Section titled “Output”+------------+----------+---------+| EmployeeId | Name | Position|+------------+----------+---------+| 1 | John Doe | Manager || 2 | Jane Doe | Analyst |+------------+----------+---------+Explanation
Section titled “Explanation”In the above example, we use ‘SELECT * FROM Employees’ SQL statement in the markdown format to display all data from the Employees table. The output is displayed in a tabulated format with EmployeeId, Name, and Position as columns.
Example
Section titled “Example”SELECT * FROM employees;Output
Section titled “Output”| id | name | role ||----|---------|---------|| 1 | John | Manager || 2 | Jane | Analyst || 3 | Sam | Engineer|Explanation
Section titled “Explanation”The SQL query SELECT * FROM employees; gathers all records from the employees table. The output is formatted in markdown to present an easily readable table.
Example
Section titled “Example”Markdown for SQL code:
SELECT *FROM Customers;Markdown for output:
ID | NAME | AGE | ADDRESS | SALARY---|-------|-----|----------|------1 | Ramesh| 32 | Ahmedabad| 2000.002 | Khilan| 25 | Delhi | 1500.003 | Kaushik| 23 | Kota | 2000.004 | Chaitali| 25| Mumbai | 6500.005 | Hardik | 27| Bhopal | 8500.006 | Komal | 22| MP | 4500.007 | Muffy | 24| Indore | 10000.00Output
Section titled “Output”| ID | NAME | AGE | ADDRESS | SALARY |
|---|---|---|---|---|
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | Kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
Explanation
Section titled “Explanation”This is an example of displaying a table from SQL Server Database. The “SELECT *” command is used to select all the columns from the “Customers” table. Markdown is used to format the SQL code and the corresponding output. The formatted SQL code is enclosed within sql and , and the formatted output is enclosed within and to differentiate it from other text.
Example
Section titled “Example”SELECT * FROM Employees;Output
Section titled “Output”| EmployeeId | LastName | FirstName | HireDate ||------------|----------|-----------|------------|| 1 | Doe | John | 2010-04-12 || 2 | Smith | Jane | 2012-05-20 || 3 | Brown | Paul | 2009-08-15 |Explanation
Section titled “Explanation”In the example shown above, the SQL statement is written to query all existing records from the Employees table. The output is then displayed in a Markdown-formatted table. Each row corresponds to a distinct record in the table. The columns represent different fields of the record such as EmployeeId, LastName, FirstName, and HireDate.
Example
Section titled “Example”CREATE TABLE Employees( ID int, Name varchar(255), Salary float, StartDate date, City varchar(255), Region char(1));
INSERT INTO EmployeesVALUES (1, 'John', 70000, '2013-01-01', 'New York', 'N'),(2, 'Mike', 80000, '2014-01-01', 'Boston', 'E'),(3, 'Amy', 50000, '2013-01-01', 'Chicago', 'W'),(4, 'Jessica', 60000, '2012-01-01', 'Seattle', 'W');
SELECT * FROM Employees;Output
Section titled “Output”| ID | Name | Salary | StartDate | City | Region ||----|---------|--------|-----------|---------|--------|| 1 | John | 70000 | 2013-01-01| New York| N || 2 | Mike | 80000 | 2014-01-01| Boston | E || 3 | Amy | 50000 | 2013-01-01| Chicago | W || 4 | Jessica | 60000 | 2012-01-01| Seattle | W |Explanation
Section titled “Explanation”The SQL code in this example first creates a table named “Employees” with specific attributes. The “INSERT INTO” statement is then used to populate the table with data. The final statement is a “SELECT *” command, which selects and displays all records from the table. The output shows the table displayed in markdown format with four rows of data that match the inserted records. Each row represents an employee record and displays details such as employee ID, name, salary, start date, city, and region.