Learning from bugs using together : list,distinct,case,extract weekday

Seems that the bug CORE-3302 is triggered when there are millions of rows and only in firebird 2.5 and 3.0 (Bug is already fixed in svn)
What you can learn from the bug is the usage of list,distinct,case,extract weekday in the same query

First i have created the query to extract the day in string format from current date
select
list(case extract(weekday from CURRENT_DATE) when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue' when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri' when 6 then 'Sat' end)
from RDB$DATABASE

In my case the result was Fri.
Then you can create a table with different dates:

CREATE table tasks
(
DATE_OF_TASK DATE
);

Populate the table

INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-07');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-06');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');
INSERT INTO TASKS (DATE_OF_TASK) VALUES ('2011-01-08');

Then start to run the query

select
list(distinct case extract(weekday from date_of_task) when 0 then 'Sun' when 1 then 'Mon' when 2 then 'Tue' when 3 then 'Wed' when 4 then 'Thu' when 5 then 'Fri' when 6 then 'Sat' end)
from tasks

Result should be:

Fri,Sat,Thu
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Testing boolean columns in Firebird 3.0

After the new year eve i wanted to test the new boolean columns in the new build that added them for firebird 3.0 , so i have created the columns and then inserted some random bool vaules for test after that i have started to test the bool expressions (and , or  …) in a select from the new bool values.

ps: the select worked in isql-fb only , in flamerobin the datatype is not implemented yet (default from ubuntu 0.9.2)

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 5.00 out of 5)
Loading...

Firebird SQL linkedin Community is now an open group

I am pleased to announce that, as the owner of this group, I have just switched us to an open discussion group. All future discussions will be fully visible, searchable, and shareable on the Web. All past discussions are now closed in a members-only archive. I look forward to our future discussions now joining the broader conversation of the wider Web.

Posted By Dumitru Condrea
Go to the complete announcement
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...

Database Workbench 4.1 released

Ladies, gentlemen,

Upscene Productions is proud to announce the next
version of the popular multi-DBMS development tool:

” Database Workbench 4.1.0 Pro ”

This release includes the FREE Lite versions for InterBase, Firebird
and MySQL.

Version 4 introduced full Unicode support, 4.1.0 adds new features,
latest DBMS support and improved functionality.

For more information, see here.

Click here for the full list of changes in v4.1

Database Workbench supports:
– Borland InterBase ( 4.x – XE )
– Firebird ( 1.x, 2.x )
– MS SQL Server/MSDE ( 7, 2000, 2005, 2008, MSDE 1 & 2, SQL Express )
– MySQL 4.x, 5.x
– Oracle Database ( 8i, 9i, 10g, 11g )
– Sybase SQL Anywhere ( 9, 10, 11 and 12 )
– NexusDB ( 3.0 and up )

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...

Testing identity columns in Firebird 3.0

Someone on support list asked about identity column in Firebird and how it can be managed easier and i remembered that identity is already supported firebird 3.0 so i fired up flamerobin and created a table with new identity column type similar to MSSQL “identity”, MySQL “auto_increment” or PostgreSQL “serial”
All worked as in documentation 🙂 inserting and selecting from the table no generators/triggers were needed to be created by hand

1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 4.89 out of 5)
Loading...

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

1 … 230 231 232 233 234 … 495