Quantcast
Channel: SQL – Monkey Can Code
Browsing all 11 articles
Browse latest View live

Oracle: get detail table information

You can use SQL*Plus to provide the following details about a table: 1. Column Details 2. PRIMARY KEY 3. INDEXES 4. FOREIGN KEYS 5. CONSTRAINTS 6. ROWCOUNT 7. Other Tables That REFER to this Table 8....

View Article



Prompt for variable in SQL Script

Simple tutorial on how to write a Oracle P-SQL script that asks user for a value in a prompt. /* -- this script will update MLP identity across all related tables in LIMS correctly -- -- when executing...

View Article

Example SQL Script use Cursor

Here is a very very simple Oracle P-SQL script that uses a cursor to do some operation: SET SERVEROUTPUT ON   DECLARE CURSOR curMLPList IS SELECT DISTINCT IDENTITY FROM MLP_HEADER WHERE ROWNUM < 10...

View Article

Drop All Tables in a schema (Oracle)

This script would create a drop table script for all the tables -- Drop All Tables in a schema:   -- Drop_Tables.sql - Creates script to drop all tables and views from schema -- Use: script reads table...

View Article

Oracle SQL: Escape in LIKE clause

The underscore in oracle SQL, when it’s used in LIKE clause represent a one character wild card. For example: like ‘V_KAA’ (returns VaKAA, VbKAA) But you want to find something like V_KAAA (including a...

View Article


SQLite: system date time now

-- display current system date time select (date_time('now'));   -- to insert with system date time insert into table (date_created) values (date_time('now'));

View Article

SQLite: select certain # of records

A column name can be any of the names defined in the CREATE TABLE statement or one of the following special identifiers: “ROWID”, “OID”, or “_ROWID_”. These special identifiers all describe the unique...

View Article

Android: SQLite select data using SQL statement returning cursor

Use the .rawQuery function to use a SQL statement to retrieve data into cursor. public Cursor fetchAllDineoutHistoryFormatDate(){   String sSelect = "SELECT " + K_ROWID + ", " + K_TITLE + ", " + K_DATE...

View Article


Find Duplicate value in a field (Oracle table)

If you want to find the duplicate values in a specific field in an Oracle table, use the following SQL query:   SELECT FIELD, COUNT(FIELD) from TABLE GROUP BY FIELD HAVING COUNT(FIELD) > 1;

View Article


ORACLE: Show Statistic Updates

The following Oracle SQL command allows you to see the statistics information, grouping by the last analyzed date (the is the name of schema you need to substitute into the SQL query: select...

View Article

Oralce PL/SQL: Prompt for choice in execution

In Oracle PL/SQL, you can put in your script that would give the user a choice to either go on or quit. The following example gives you a prompt then a user choice of Y or N. Based on the user choice Y...

View Article
Browsing all 11 articles
Browse latest View live




Latest Images