Skip to content

Instantly share code, notes, and snippets.

Pantelis Theodosiou ypercube

  • Athens, Greece
Block or report user

Report or block ypercube

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View recursive_stored_procedure.sql
ALTER PROCEDURE [dbo].[Providers_Get_All_Spacial_Terms_New]
...
AS
BEGIN
IF Object_id('tempdb..#T') IS NOT NULL
BEGIN
INSERT INTO #T ....
END
View gist:661e123ba61fc8dc2ab1
stream = [1,2,3,4,5,6,7,7,7,7]
def maxN(stream, n):
result = []
for i in stream:
if i not in result:
result.append(i)
result.sort(reverse=True)
result = result[0:n]
View setup.sql
CREATE TABLE IF NOT EXISTS items (
id serial PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS industries (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS items_industries (
View gist:9758793
SELECT task_events.task_id, task_events.state
FROM tasks
INNER JOIN task_events ON task_events.task_id = tasks.id
WHERE task_events.created_at =
(SELECT MAX(task_events.created_at) FROM task_events WHERE task_events.task_id = tasks.id)
GROUP BY tasks.id, task_events.id
ORDER by tasks.id ;
View gist:9744718
-- DDL
-- company
CREATE TABLE company (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(64) NOT NULL,
date_certif_start DATE NOT NULL,
date_certif_end DATE NOT NULL,
status SMALLINT NOT NULL,
about VARCHAR NULL
);
You can’t perform that action at this time.