I have table create table1( column1 number(10, column2 number(10), column3 number(10) ); column1 is Primary Key column2 and column3 is Foreign key I have created unique constraint on 2 …
Is there any way to show progress on a `gunzip < database.sql.gz | mysql …` process?
Once a week I need to run a giant database update into my local development environment like so: $ gunzip < /path/to/database1.sql.gz | mysql -uUSER -p database1 & $ gunzip < /path/to/…
Drop Several Tables at Once
I have some tables that I need to drop on a regular basis. The names of the tables sometimes change but the table names always begin with ‘db_comp_temp’. Is it possible to write some SQL that will in effect do something like: Thanks in advance, Answer No, there is no wildcard support in DDL. Or: Y…
How to know location about partition in hive?
If I write a hive sql like ALTER TABLE tbl_name ADD PARTITION (dt=20131023) LOCATION ‘hdfs://path/to/tbl_name/dt=20131023; How can I query this location about partition later? Because I found there …
Formatting a variable as a string
I am trying to create a Python program that will query a URL and produce a JSON file. I need to pass an argument in the end of the URL which comes from the SQL query. I have imported the requests …
Select by -3 days?
I’m trying to select data from a specific table in my database, but I want to be able to only view the last 3 days worth of data, I have the following code but for some reason I can’t get it to work. Answer You may avoid usage of DATE_ADD() at all: As @OGHaza mentioned, you specified column with a…
Return All Months & Years Between Date Range – SQL
I’m a bit stumped how I might go about this. I have a very basic query, that currently returns sales for each product, by year and month. It is grouping by year/month, and summing up the quantity. This returns one row for each product/year/month combo where there was a sale. If there was no sale for a m…
sql-ex exercise 39 failed on second server error?
Exercise 39: Define the ships that “survived for future battles”; being damaged in one battle, they took part in another. Database Schema: http://www.sql-ex.ru/help/select13.php#db_3 My approach: sql-ex says Your query produced correct result set on main database, but it failed test on second, che…
SQL count of distinct records against multiple criteria
I have a table in SQL SERVER “usage” that consists of 4 columns Now I need to query the table so that I can find how many users used an app under a license within a time frame. Bearing in mind that even if user 1 used the app on say january 1st and 2nd they would only count as
USE database_name command alternative for Oracle
what is the alternative of use database_name command of SQL server in oracle?