ANSI Standards – Database – Substring

Background Reviewing some SQL and wanted to point out a tiny dissimilarity between database platforms. Data Our test table is Oracle's SCOTT.EMP Here is what the data looks like :- Substring/Substr The HIREDATE is the only well formatted fixed length string. Its format is DD-MMM-YY. Query Oracle SQL Output Explanation Oracle relies on Substr to … Continue reading ANSI Standards – Database – Substring

PostgreSQL :- Datatype – bpchar

Background I went back and started reviewing the script uses for creating the customer table in the Northwind database. northwind pthom We are using the script furnished by pthom. It is published via GitHub and availed here. Here is the portion that creates the customer table What is bpchar? The customer_id column is defined as bpchar … Continue reading PostgreSQL :- Datatype – bpchar

DBeaver – Table Relationships

Background Just wanting to make sure that I am properly tracking table relationships in MySQL.   Code INFORMATION_SCHEMA INFORMATION_SCHEMA.KEY_COLUMN_USAGE Code Sample Output   Tools DBeaver Outline Steps to follow to track visually through DBeaver Launch DBeaver Connect to MySQL Instance Navigate to Database Tables <Specific Table> Double Click on the selected table On the right … Continue reading DBeaver – Table Relationships

Transact SQL – Constraint – Primary Key

There are a couple of approaches one can use to get the primary key for a table. Here are some of those ways: sp_pkeys sp_primarykeys INFORMATION_SCHEMA.TABLE_CONSTRAINTS sp_pkeys Syntax: Sample: Output: sp_primarykeys Though sp_primarykeys was added to gain insight into remote data sources, you can use it it to query your local data source, as well. … Continue reading Transact SQL – Constraint – Primary Key

Database – INFORMATION_SCHEMA – Use Case Scenario

Occasionally, one might find it useful to quickly get "structural" information about databases, tables, and columns. That is where the INFORMATION_SCHEMA object comes in.  They are part of ANSI Standards. Each DB Vendor calls them by different names: Microsoft calls them INFORMATION_SCHEMA IBM DB/2 and UDB calls them SYSIBM Oracle calls them Data Dictionary   … Continue reading Database – INFORMATION_SCHEMA – Use Case Scenario