Skip to content

Instantly share code, notes, and snippets.

use mydatabase;
CREATE TABLE IF NOT EXISTS student_count_report (
school_name string,
student_coun BIGINT
) ROW FORMAT delimited fields terminated BY ;
use mydatabase;
CREATE TABLE IF NOT EXISTS student (
student_id BIGINT,
name string,
lastname string,
birth_date string,
school_id BIGINT
) ROW FORMAT delimited fields terminated BY ;
use mydatabase;
CREATE TABLE IF NOT EXISTS school
(
school_id BIGINT,
school_name string
) ROW FORMAT delimited fields terminated BY ',';

Testing is really important for coding. It provide ensuring the code is working. It is really a way to gain rather it is thought as time lost. This is actually another topic sould be discussed in another article.

Unit-testing is one of most tough thing among coding phases. If you are dealing with data, it is getting harder to do it. Many people give up on that challenging phase. But If you are a good developer - by the way that means, you are addicted to produce good quality of code which can not be broken easily after you first say, I am done - you must love that phase. Becuase, this phase will be the phase that makes you make sure about what you did. I said, this is another topic, but I couldn't keep myself away from talking about it :-) .

As I said, when you are dealing with test needs data, it is hard to prepare those kind of test data which is called as provided data or initial data. (There are some tools to make it easier. I will also talk about it in another article). Actualy, complexity in the ca

I met a problem with jenkins novadays which I barely figure out what the problem is. It was very strange and I very encounter a term named Shebang which is mostly at the first line of a script which can be runnable on shell. You will get what I mean via that example;

#!/usr/bin/python # this is the shebang

print 'Hello world'

The problem about shebang is, there is a character length limit. If you exceed the limit, the script can't be run. This limit was 128 characters for my Ubuntu16.04 machine, but I saw some other limits like 64 etc. So this limit may be different for your machines.

Category Product Name Product Description
Casual Black Shoe This is a shoe
Electronic Washing Machine This is a washing machine
Casual Blue Trousers This is trousers
SELECT
p.category,
p.product_name,
p.product_description
FROM (
SELECT
p.category,
p.product_name,
p.product_description,
(percent_rank() OVER w1) * 100 AS percent_rnk
Category Product Name Product Description
Casual Black Shoe This is a shoe
Electronic Washing Machine This is a washing machine
Electronic TV This is a tv
Casual Blue Trousers This is trousers
SELECT
p.category,
p.product_name,
p.product_description
FROM (
SELECT
p.category,
p.product_name,
p.product_description,
rank() over w1 rnk
This is shoe
Category Product Name Product Description
Casual Black Shoe