Trying to share some code ideas

logo

Tag: SQL Page 2 of 3

Oracle PL/SQL Subtotal Operators

Oracle PL/SQL Subtotal Operators

There are times when we need not just the total value for the column, but subtotal values depending on different column values.  Oracle supports subtotal operators through the three key operators they are CUBE, ROLLUP, and GROUPING SETS. Below are examples of each one and how best to use them.

Aggregation in Oracle PL/SQL

Aggregation in Oracle PL/SQL

Oracle 12 uses normal SQL statements when doing aggregation.  The standard rules for aggregating in SQL apply.  You need to group by all non aggregated columns and having clause will be evaluated after the group by operator.

Some examples of aggregation in Oracle PL/SQL are below.

Dropping Tables in Oracle PL/SQL

Dropping Tables

Below are some examples of how to create tables in Oracle 12. PL/SQL, for the most part PL/SQL follows standard SQL conventions.

Creating Tables in Oracle 12 PL/SQL

Creating Tables

Below are some examples of how to create tables in Oracle 12. PL/SQL. For the most part PL/SQL follows standard SQL conventions.  I will show how to create some tables and some of the more popular options when creating tables.

SQLite Interface Class for R

SQLite Interface Class for R

I wrote an interface class to help with working with the SQLite database.

Methods include, selectQuery, updateQuery, readTable, writeTable

 

see code below

Datatype Cast in T-SQL

“Making a square peg fit into a round hole”

There are many times when dealing with data that you need to transfigure one data set to allow for comparison purposes.

SQL has built in functions that easily allow us to transfigure data. There are some considerations when using the functions, most importantly understanding what will happen to the data set during the process.

Today I will talk about the CAST function.

SQL Update Many Rows

When working with a large table the UPDATE statement can easily bring even the most robust server to a screeching halt. In this posting I will show an alternative so even the largest tables can be updated without negatively impacting server performance.

Updating a million rows

Microsoft Access and ANSI

“What you don’t know can’t hurt you can drive you bonkers.” – R. Hedgins

Today’s posting will deal with an option setting that can minimize interoperability issues between Microsoft’s nuanced interpretations of standards.

Microsoft Access and Microsoft SQL

SQL Union – New Ideas

“Union of ideas begets a surprising confidence” – J. Madison

Today’s post will deal with an SQL command many of us may be familiar with but may forget exists, or haven’t thought about other uses for it.

UNION

In simplest terms the UNION command allows you to join separate SQL queries into one result set. The UNION command has one optional option “ALL”

Views, we need all the Views

There are times when you want to find all of the views that are in your Microsoft SQL database.  Especially when there are 1,000’s of views.  Each with the naming convention of the previous 5 DBA’s personal whims.  Normally as a database ages the views will become duplicative and add to the general clutter that gets in the way of efficiency.

List all views in a database

Page 2 of 3

Powered by WordPress & Theme by Anders Norén