### SQL Example: Film Table Setup Source: https://docs.oxla.com/sql-reference/sql-functions/window-functions/bool-and Demonstrates SQL commands to manage a 'film' table, including dropping it if it exists and creating it with basic columns. This setup is used for illustrating query examples. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( title VARCHAR(255), length INT, rating VARCHAR(10) ); ``` -------------------------------- ### SQL Example: Setup Film Table Source: https://docs.oxla.com/sql-reference/sql-functions/window-functions/avg This example SQL script demonstrates how to set up a sample 'film' table for use with window functions. It includes statements to drop the table if it already exists and then create it with columns for film title, length, and rating. This setup is typical for practicing database operations and analytical queries. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( film_id SERIAL PRIMARY KEY, title VARCHAR(255) NOT NULL, length INT, rating DECIMAL(3,1) ); ``` -------------------------------- ### SQL CREATE Keyword Example Source: https://docs.oxla.com/sql-reference/sql-statements/create-table A minimal example highlighting the SQL CREATE keyword, often used as a starting point for DDL statements. ```sql CREATE ``` -------------------------------- ### SQL NTILE Function Example Source: https://docs.oxla.com/sql-reference/sql-functions/window-functions/ntile Provides a practical SQL example demonstrating the NTILE function. This snippet includes setup for a 'film' table, data insertion, and a query that partitions and orders data to apply the NTILE function. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( film_id SERIAL PRIMARY KEY, title VARCHAR(255), length INT, rating VARCHAR(10) ); INSERT INTO film (title, length, rating) VALUES ('Film A', 120, 'PG'), ('Film B', 90, 'R'), ('Film C', 150, 'PG-13'), ('Film D', 110, 'R'), ('Film E', 130, 'PG'), ('Film F', 100, 'G'), ('Film G', 140, 'PG-13'), ('Film H', 105, 'R'); SELECT title, length, rating, NTILE(4) OVER (ORDER BY length DESC) as length_bucket FROM film; ``` -------------------------------- ### SQL Table Setup Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/ordered-set-aggregate-functions/percentile-disc Demonstrates the SQL commands to create a sample 'film' table and populate it with data, based on a simplified version from the Pagila database. This includes dropping the table if it already exists to ensure a clean setup. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( title VARCHAR(255), length INT, rating VARCHAR(10) ); ``` -------------------------------- ### SQL Table Setup Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/regr-r2 An SQL snippet demonstrating how to drop and potentially recreate a 'film' table, as used in the example for the REGR_R2 function. This is a common setup step for database examples. ```sql DROP TABLE IF EXISTS film; ``` -------------------------------- ### SQL: Create and Insert Data into listofwords Table Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/strpos Demonstrates how to create a 'listofwords' table and populate it with sample data using SQL. This setup is necessary for subsequent examples. ```sql CREATE TABLE listofwords ( words text ); INSERT INTO listofwords (words) VALUES ('corral'), ('traditionally'), ('real'), ('communal'), ('challenge'), ('fall'), ('wall'), ('gallop'), ('albatross'); ``` -------------------------------- ### Oxla Quickstart Guide Source: https://docs.oxla.com/sql-reference/sql-functions/other-functions/col-description A quick guide to get Oxla running in a minimal amount of time. ```APIDOC Quickstart: - Run Oxla in 2 minutes. - Provides step-by-step instructions for a rapid setup. ``` -------------------------------- ### Client Tool - Java (JDBC) Source: https://docs.oxla.com/sql-reference/sql-functions/boolean-functions/if-function Guides on connecting to Oxla using Java Database Connectivity (JDBC). This section provides setup and usage examples for Java applications. ```Java import java.sql.*; // Example usage: // String url = "jdbc:postgresql://host:port/database"; // try (Connection conn = DriverManager.getConnection(url, "user", "password")) { // Statement stmt = conn.createStatement(); // ResultSet rs = stmt.executeQuery("SELECT * FROM my_table"); // while (rs.next()) { // // Process results // } // } ``` -------------------------------- ### Dotnet Client (Dapper) Source: https://docs.oxla.com/sql-reference/sql-clauses/set-operations/overview Guide for integrating Oxla with .NET applications using Dapper. It covers connection setup, executing queries, and mapping results to C# objects, providing examples for common database operations. ```csharp using Dapper; using System.Data; using Npgsql; // Assuming Npgsql for PostgreSQL compatibility public class UserRepository { private readonly string _connectionString; public UserRepository(string connectionString) { _connectionString = connectionString; } public async Task GetUserByIdAsync(int userId) { using (IDbConnection db = new NpgsqlConnection(_connectionString)) { return await db.QuerySingleOrDefaultAsync("SELECT * FROM users WHERE id = @Id", new { Id = userId }); } } } ``` -------------------------------- ### SQL CREATE TABLE Example Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/starts-with An example SQL statement demonstrating the creation of a 'petsData' table with 'petid', 'petname', and 'pettype' columns, used in subsequent STARTS_WITH function examples. ```sql CREATE TABLE petsData ( petid int, petname text, pettype text ) ``` -------------------------------- ### SQL SUBSTR Example: Specified Start Position & Length Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/substr Demonstrates the usage of the SUBSTR function with a specified start position and length. This example extracts a substring from 'Watermelon' starting at the 6th character for a length of 5 characters. ```sql SELECT substr('Watermelon', 6, 5) AS "Fruit"; ``` -------------------------------- ### SQL Table Creation and Data Insertion Source: https://docs.oxla.com/sql-reference/sql-clauses/where Demonstrates how to create a 'salary' table and insert sample data using SQL. This setup is used for subsequent query examples. ```SQL CREATE TABLE salary ( empid int, empname text, empdept text, empaddress text, empsalary int ); INSERT INTO salary (empid, empname, empdept, empaddress, empsalary) VALUES (2001,'Paul','HR', 'California', null ), (2002,'Brandon','Product', 'Norway', 15000), (2003,'Bradley','Marketing', 'Texas', null), (2004,'Lisa','Marketing', 'Houston', 10000), (2005,'Emily','Marketing', 'Texas', 20000), (2006,'Bobby','Finance', 'Seattle', 20000), (2007,'Parker','Project', 'Texas', 45000); ``` -------------------------------- ### SQL STARTS_WITH Function Example Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/starts-with Illustrates the behavior of a SQL STARTS_WITH function, showing how it returns true for matching string prefixes and handles null values. The example displays a table with 'breed' and 'starts_with' columns. ```sql +--------------------+--------------+ | breed | starts_with | +--------------------+--------------+ | persian | true | | boston terrier | true | | dzungarian | true | | dobberman | true | | american shorthair | true | | | true | +--------------------+--------------+ ``` -------------------------------- ### SQL SUBSTR Function Example (Start Position) Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/substr Illustrates the output of a SQL SUBSTR function when extracting a substring starting from a specific position. The example shows extracting 'melon' from 'Watermelon'. ```sql Fruit ------- melon ``` -------------------------------- ### Docker Installation - Fedora Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide specifically for Fedora. ```html Fedora ``` -------------------------------- ### Docker Installation - Debian Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide specifically for Debian. ```html Debian ``` -------------------------------- ### Create and Insert Sample Data Source: https://docs.oxla.com/sql-reference/sql-mutations/update Demonstrates how to create a sample 'tasks' table and insert initial data records using CREATE TABLE and INSERT statements. ```sql CREATE TABLE tasks ( task_id INT, task_name TEXT, status TEXT ); INSERT INTO tasks (task_id, task_name, status) VALUES (1001, 'Task A', 'pending'), (1002, 'Task B', 'in-progress'), (1003, 'Task C', 'pending'); ``` -------------------------------- ### Docker Installation - Ubuntu Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide specifically for Ubuntu. ```html Ubuntu ``` -------------------------------- ### PostgreSQL Example: Create Table and Index Source: https://docs.oxla.com/sql-reference/sql-functions/other-functions/pg-get-indexdef An example SQL snippet demonstrating how to create a sample table and an index, which can then be used with the `pg_get_indexdef()` function. ```sql CREATE TABLE sample_table(col "int") ``` -------------------------------- ### Docker Installation - CentOS Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide specifically for CentOS. ```html CentOS ``` -------------------------------- ### SQL Schema Creation Example Source: https://docs.oxla.com/sql-reference/schema Demonstrates how to create a schema in SQL. This example shows the basic syntax for creating a schema named 'oxladb'. ```sql CREATE SCHEMA oxladb; ``` -------------------------------- ### Docker Installation - Raspberry Pi OS Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide for Raspberry Pi OS (32-bit). ```html Raspberry Pi OS (32-bit) ``` -------------------------------- ### Routing Configuration Example Source: https://docs.oxla.com/sql-reference/sql-clauses/from/from Illustrates a routing configuration, potentially for a web framework. It shows how subdomains, slugs, and page components are mapped for navigation. ```javascript { "children": [ ["subdomain", "docs.oxla.com", "d"], ["$", "$1", "c", { "children": [ null, ["$", "$L2", null, { "parallelRouterKey": "children", "error": "$6", "errorStyles": [], "errorScripts": [], "template": ["$", "$L4", null, {}], "templateStyles": "$undefined", "templateScripts": "$undefined", "notFound": "$L7", "forbidden": "$undefined", "unauthorized": "$undefined" }] ] }], { "children": [ ["slug", "sql-reference/sql-clauses/from/from", "oc"], "$La", { "children": [ "__PAGE__", "$Lb", {}, null, false ] }, null, false ] }, null, false ], "m": "$undefined", "G": ["$f", []], "s": false, "S": true } ``` -------------------------------- ### SQL: Create and Insert Sample Data Source: https://docs.oxla.com/sql-reference/sql-clauses/order-by Demonstrates the SQL syntax for creating a 'salaryemp' table with employee details and inserting sample records. This setup is used for subsequent query examples. ```SQL CREATE TABLE salaryemp ( emp_id int, emp_name text, emp_div text, emp_sal int ); INSERT INTO salaryemp VALUES (1002, 'Mike', 'Marketing', 6000), (1003, 'Sean', 'Marketing', 6500), (1004, 'Victor', 'Finance', 7000), (1005, 'Lewis', 'Sales', 5500), (1006, 'David', 'Marketing', 8000), (1007, 'Omar', 'Finance', 8000), (1008, 'Meghan', 'Finance', 7500), (1009, 'Harry', 'Operations', 4500), (1010, 'Steve', 'Marketing', 6800), (1011, 'David', 'Sales', 8200); ``` -------------------------------- ### Docker Installation - RHEL Link Source: https://docs.docker.com/engine/install/ Provides a direct link to the Docker Engine installation guide specifically for Red Hat Enterprise Linux (RHEL). ```html RHEL ``` -------------------------------- ### Create and Insert Client Table Source: https://docs.oxla.com/sql-reference/sql-clauses/from/from Demonstrates how to create a 'client' table with specified columns and insert sample data into it using SQL. ```SQL CREATE TABLE client ( client_id int, client_name text, client_origin text ); INSERT INTO client (client_id, client_name, client_origin) VALUES (181891,'Oxla','Poland'), (181892,'Google','USA'), (181893,'Samsung','South Korea'); ``` -------------------------------- ### Docker Engine Installation - Table of Contents Source: https://docs.docker.com/engine/install/ Markdown representation of the table of contents for the Docker Engine installation guide, outlining key sections like supported platforms, release channels, and upgrade paths. ```markdown Table of contents * [Supported platforms](#supported-platforms) * [Other Linux distributions](#other-linux-distributions) * [Release channels](#release-channels) * [Support](#support) * [Upgrade path](#upgrade-path) * [Licensing](#licensing) * [Reporting security issues](#reporting-security-issues) * [Get started](#get-started) ``` -------------------------------- ### SQL CREATE TABLE Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/sum Provides an example SQL statement for creating a 'customer' table with customer_id and name columns. ```sql CREATE TABLE customer ( customer_id int, name varchar ) ``` -------------------------------- ### STDDEV_POP() SQL Function Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/stddev-pop Provides a SQL example demonstrating the usage of the STDDEV_POP() function. It includes setup for a sample 'film' table and a query to illustrate its application. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( film_id integer NOT NULL, title character varying(255) NOT NULL, description text, release_year year, language integer, original_language integer, rental_duration smallint NOT NULL, rental_rate numeric(4,2) NOT NULL, length smallint, replacement_cost numeric(5,2) NOT NULL, rating "char" DEFAULT 'G'::"char", last_update timestamp without time zone NOT NULL, special_features text[], fulltext tsvector NOT NULL ); -- Example usage (assuming data is populated): -- SELECT STDDEV_POP(length) FROM film; ``` -------------------------------- ### Create and Populate Product Table Source: https://docs.oxla.com/sql-reference/sql-clauses/from/from Defines the 'product' table schema with columns for ID, product name, category, and price. It then inserts sample data into this table. ```sql CREATE TABLE product ( id int, product text, category text, price int ); INSERT INTO product (id, product, category, price) VALUES (445747,'Court vision women’s shoes nike','Shoes', 8000), (445641,'Disney kids h&m','Shirt', 6500), (477278,'Defacto adidas','Hat', 8500), (481427,'Sophie shopping bag','Bag', 6500), (411547,'Candy skirt zara','Skirt', 6500), (488198,'Slim cut skirt hush puppies','Skirt', 7600); ``` -------------------------------- ### SUBSTR() Usage Example Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/substr Demonstrates how to use the SUBSTR() function to extract a substring from a given string starting from a specific position. The example extracts characters from position 6 onwards. ```sql SELECT SUBSTR('database', 6) AS "Result"; ``` -------------------------------- ### SQL CREATE TABLE and INSERT Statements Source: https://docs.oxla.com/sql-reference/sql-clauses/from/right-join This snippet shows how to create a 'customer' table with an ID and name, and then insert sample records into it. It includes basic SQL DDL and DML syntax. ```sql CREATE TABLE customer ( id int NOT NULL, customer_name text ); INSERT INTO customer (id, customer_name) VALUES (201011, 'James'); INSERT INTO customer (id, customer_name) VALUES (200914, 'Harry'); ``` -------------------------------- ### PostgreSQL Table and Index Creation Source: https://docs.oxla.com/sql-reference/sql-functions/other-functions/pg-get-indexdef Demonstrates the SQL commands to create a sample table and an index on one of its columns. This is a foundational step for index management. ```sql CREATE TABLE sample_table(col int); CREATE INDEX sample_index ON sample_table(col); ``` -------------------------------- ### PostgreSQL pg_total_relation_size() Example Source: https://docs.oxla.com/sql-reference/sql-functions/other-functions/pg-total-relation-size This example demonstrates how to use the pg_total_relation_size() function to get the size of a 'users' table. It includes creating a sample table for context. ```sql CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(100) ); SELECT pg_total_relation_size('users'); ``` -------------------------------- ### SQL STARTS_WITH Function Details Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/starts-with Provides a comprehensive overview of the STARTS_WITH SQL function, including its parameters, expected input/output types, and specific edge cases. ```APIDOC STARTS_WITH(first_argument, second_argument) Description: Checks if the 'first_argument' string starts with the 'second_argument' string. Parameters: - first_argument: The string or column name to check. Can be of type STRING. - second_argument: The prefix string to search for. Can be of type STRING. Return Value: - BOOL: Returns 'true' if 'first_argument' starts with 'second_argument', otherwise 'false'. Special Cases: - NULL Handling: Returns NULL if the 'first_argument' record is NULL. - Empty Prefix: Returns 'true' (including for NULL records) if 'second_argument' is not specified or is an empty string. Input Type: STRING Return Type: BOOL ``` -------------------------------- ### MODE() Aggregate Function Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/ordered-set-aggregate-functions/mode Provides an SQL example demonstrating how to use the MODE() function. It includes setup for a simplified 'film' table and a query to find the mode of film lengths. ```SQL DROP TABLE IF EXISTS film; CREATE TABLE film ( title VARCHAR(255), length INT, rating VARCHAR(10) ); INSERT INTO film (title, length, rating) VALUES ('Film A', 120, 'PG'), ('Film B', 150, 'R'), ('Film C', 120, 'PG-13'), ('Film D', 180, 'NC-17'), ('Film E', 120, 'PG'); SELECT MODE() WITHIN GROUP (ORDER BY length) AS mode_length FROM film; ``` -------------------------------- ### SQL Table Structure Example Source: https://docs.oxla.com/sql-reference/sql-clauses/from/from Demonstrates a basic SQL table structure with client name and origin columns, showing sample data. ```sql +--------------+------------------+ | client_name | client_origin | +--------------+------------------+ | Oxla | Poland | | Google | USA | | Samsung | South Korea | +--------------+------------------+ ``` -------------------------------- ### SQL OFFSET Clause Example Source: https://docs.oxla.com/sql-reference/sql-clauses/offset Provides an example demonstrating the creation of a table and insertion of values, followed by a conceptual application of the OFFSET clause. Note: The provided example focuses on table setup rather than a direct OFFSET query execution. ```sql 1. Here, we are creating one new table called oxlafunctions using the CREATE TABLE command and inserting some values into the table using the INSERT command: -- Example table creation and insertion (context for OFFSET usage) CREATE TABLE oxlafunctions ( id INT PRIMARY KEY, name VARCHAR(255), value INT ); INSERT INTO oxlafunctions (id, name, value) VALUES (1, 'FunctionA', 100), (2, 'FunctionB', 150), (3, 'FunctionC', 200), (4, 'FunctionD', 250), (5, 'FunctionE', 300); -- Conceptual usage of OFFSET (not directly in the provided snippet, but implied context) -- SELECT name, value FROM oxlafunctions ORDER BY id OFFSET 2; ``` -------------------------------- ### SQL SUBSTR with Start Position and Length Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/substr Illustrates the SUBSTR function in SQL when extracting a substring starting from the 6th character and taking 5 characters. This example shows how to extract a specific portion of a string. ```sql SELECT substr('Watermelon', 6, 5); ``` -------------------------------- ### Create and Populate time_example Table Source: https://docs.oxla.com/sql-reference/sql-functions/timestamp-functions/unix-seconds Defines a table named 'time_example' with a timestamp column and inserts sample data for demonstration purposes. ```sql CREATE TABLE time_example ( time_stampvalues timestamp ); INSERT INTO time_example VALUES ('2022-12-25 13:30:00'), ('2020-09-25 07:25:00'), ('2008-12-25 15:30:00'), ('2021-10-02 06:30:00'); ``` -------------------------------- ### COVAR_POP() SQL Function Example Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/covar-pop Provides a SQL example demonstrating the usage of the COVAR_POP() function. It includes setup for a sample table and a query to calculate population covariance. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( film_id integer NOT NULL, title character varying(255), description text, release_year year, language_id smallint, original_language_id smallint, rental_duration smallint DEFAULT 3, rental_rate numeric(4,2) DEFAULT 4.99, length integer, replacement_cost numeric(5,2) DEFAULT 19.99, rating text DEFAULT 'G', last_update timestamp without time zone DEFAULT now(), special_features text[], fulltext tsvector ); -- Example usage of COVAR_POP (assuming data exists in film table for length and rating) -- SELECT COVAR_POP(length, rating) FROM film; ``` -------------------------------- ### Create and Populate Time Example Table Source: https://docs.oxla.com/sql-reference/sql-functions/timestamp-functions/unix-macros SQL statements to create a table named 'time_example' with a timestamp column and insert sample data. ```SQL CREATE TABLE time_example ( time_stamp timestamp ); INSERT INTO time_example VALUES ('2022-12-25 13:30:00'), ('2021-10-02 06:30:00'), ('2020-09-25 07:25:00'); ``` -------------------------------- ### SUBSTR Function Usage Example Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/substr Demonstrates the SUBSTR function in SQL to extract a substring from a given string based on a starting position and length. It shows how to specify the starting character index and the number of characters to extract. ```sql SELECT substr('Watermelon', 6, 5) ``` -------------------------------- ### SQL CREATE TABLE and INSERT Source: https://docs.oxla.com/sql-reference/sql-clauses/where This snippet shows how to create a 'salary' table with employee details and then insert sample data. It includes columns for employee ID, name, department, address, and salary. This is a common pattern for setting up database tables. ```sql CREATE TABLE salary ( empid int, empname text, empdept text, empaddress text, empsalary int ); INSERT INTO salary (empid, empname, empdept, empaddress, empsalary) VALUES (1, 'John', 'IT', 'New York', 50000); INSERT INTO salary (empid, empname, empdept, empaddress, empsalary) VALUES (2, 'Jane', 'HR', 'Los Angeles', 60000); INSERT INTO salary (empid, empname, empdept, empaddress, empsalary) VALUES (3, 'Peter', 'IT', 'Chicago', 55000); ``` -------------------------------- ### SQL CREATE TABLE Example Source: https://docs.oxla.com/sql-reference/sql-statements/create-table A practical example demonstrating how to create a simple table named 'users' with an 'id' and 'name' column. ```SQL CREATE TABLE users( id INT PRIMARY KEY, name VARCHAR(100) ); ``` -------------------------------- ### SQL VAR_SAMP Example Usage Source: https://docs.oxla.com/sql-reference/sql-functions/aggregate-functions/var-samp This example demonstrates how to use the VAR_SAMP function with a sample SQL table. It includes setup for a 'film' table and then calculates the sample variance of the 'length' column. ```sql DROP TABLE IF EXISTS film; CREATE TABLE film ( film_id SERIAL PRIMARY KEY, title VARCHAR(255), length INT, rating NUMERIC(3,1) ); INSERT INTO film (title, length, rating) VALUES ('Film A', 120, 8.5), ('Film B', 150, 7.9), ('Film C', 135, 9.1), ('Film D', 180, 8.2), ('Film E', 90, 7.5); SELECT VAR_SAMP(length) AS sample_variance_length FROM film; ``` -------------------------------- ### SQL POSITION() Example Source: https://docs.oxla.com/sql-reference/sql-functions/string-functions/position This example demonstrates how to use the POSITION() function to find the starting position of the substring 'world' within the string 'Hello, world!'. The function returns the index where the substring begins. ```sql SELECT POSITION('world' IN 'Hello, world!'); ``` ```sql Result: 7 ```