In SQLite there is no class used for storing date and time. But there are still some handful functions, which are for working with time information.
Archive for the ‘Database’ Category
Oracle PL/SQL Collections and Associative Arrays
Associative Arrays
DECLARE TYPE population_type IS TABLE OF NUMBER INDEX BY VARCHAR2(64); country_population population_type; continent_population population_type; howmany NUMBER; which VARCHAR2(64); BEGIN country_population('Greenland') := 100000; country_population('Iceland') := 750000; howmany := country_population('Greenland'); continent_population('Australia') := 30000000; continent_population('Antarctica') := 1000; -- Creates new entry continent_population('Antarctica') := 1001; -- Replaces previous value dbms_output.put_line('Count: ' || continent_population.count); which := continent_population.FIRST; -- Returns 'Antarctica' -- as that comes first alphabetically. which := continent_population.LAST; -- Returns 'Australia' howmany := continent_population(continent_population.LAST); -- Returns the value corresponding to the last key, in this -- case the population of Australia. -- Traverse Continents Associative Array dbms_output.put_line('Elements in continent_population: ' || continent_population.count); which := continent_population.FIRST; WHILE which IS NOT NULL LOOP dbms_output.put_line(which || ': ' || continent_population(which)); which := continent_population.NEXT(which); END LOOP; -- Outputs: -- Count: 2 -- Elements in continent_population: 2 -- Antarctica: 1001 -- Australia: 30000000 END;
Extend Oracle PL/SQL Collection
DECLARE TYPE CourseList IS TABLE OF VARCHAR2(10); courses CourseList := CourseList(); BEGIN dbms_output.put_line('Initial count= ' || courses.count || ', first= ' || courses.first || ', last= ' || courses.last || ''); courses.extend(5); dbms_output.put_line('After extend(5) count= ' || courses.count || ', first= ' || courses.first || ', last= ' || courses.last || ''); dbms_output.put_line('After extend(5) count: ' || courses.count); END;
Initial count= 0, first= , last= After extend(5) count= 5, first= 1, last= 5 After extend(5) count: 5
Oracle Database Multitable INSERT SQL
Multitable INSERT SQL can insert simultaneously into more than one tables. You can also specify optional conditions which determine which values are inserted into which tables. Read the rest of this entry »
Find SQL Executed by a Session – Oracle
The following SQL shows the SQL text for the SQL being executed by a session. Read the rest of this entry »
Show the Longest 10 Active User Sessions
The following SQL can be used by Oracle Database Administrator (DBA) to retrieve information about the currently active sessions with longest execution. The SQL statement is designed to run with SQL*Plus. Read the rest of this entry »
Select and Return Top N Rows from Oracle Database
We often need to limit the number of rows returned by a select statement. Some database servers provide extensions to the select statement. For example, MySql database sever provides LIMIT directive. In Oracle Database each result set has defined a ROWNUM pseudocolumn and ORDER BY clause interact. Read the rest of this entry »
Select Random Row form IBM DB2 Table
This tutorial shows how to select random row from IBM DB2 table. Read the rest of this entry »
Select Random Row in Microsoft SQL Server (MSSQL)
Here is a SQL query that selects a random row from a Microsoft SQL Server table. Read the rest of this entry »
Select Random Record in MySQL
The following tutorial shows how to retrieve random record from MySQL database table. Read the rest of this entry »
Select Random Record in PostgreSQL
You can use the following SQL to select random record from a PostreSQL table. Read the rest of this entry »
