Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-24 Thread Csányi Pál
2018-03-23 21:52 GMT+01:00 David Raymond : > This gets a little ugly. Was stuck for a while wondering what the heck was > going on until I found out that the modulo operator can return negatives. > Which makes absolutely no sense coming from someone who was a math major, but > hey, now I know. I

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-23 Thread David Raymond
4) ) + 52 ) % 52 from Days where DayDate < (select EndDate from SchoolYearDates where SchoolYear = '2017') ) select Days.DayDate, Days.DayOfWeek, LessonBlocks.LessonBlock, TimeTable.Grade, TimeTable.Class from Days inner join LessonBlocks on Days.WeekNumber = L

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-23 Thread csanyipal
csanyipal wrote > csanyipal wrote > 2017-09-01|F|1-2|5|b > 2017-09-01|F|1-2|7|c > 2017-09-04|M|1-2|7|b > 2017-09-04|M|1-2|5|a > 2017-09-05|Tu|1-2|8|c > 2017-09-05|Tu|1-2|8|b > 2017-09-06|W|1-2|8|a > 2017-09-06|W|1-2|7|a > 2017-09-07|Th|1-2|6|a > 2017-09-07|Th|1-2|5|c > 2017-09-08|F|3-4|5|b > 2017-0

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-23 Thread csanyipal
csanyipal wrote > 2017-09-01|F|1-2|5|b > 2017-09-01|F|1-2|7|c > 2017-09-04|M|1-2|7|b > 2017-09-04|M|1-2|5|a > 2017-09-05|Tu|1-2|8|c > 2017-09-05|Tu|1-2|8|b > 2017-09-06|W|1-2|8|a > 2017-09-06|W|1-2|7|a > 2017-09-07|Th|1-2|6|a > 2017-09-07|Th|1-2|5|c > 2017-09-08|F|3-4|5|b > 2017-09-08|F|3-4|7|c > 2

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-22 Thread csanyipal
R Smith-2 wrote > On 2018/03/21 9:58 PM, csanyipal wrote: >> >> I am really trying to understand how CTEs works and trying to achive my >> goal >> ( see bellow ) so I modified a little your code: >> ... >> As you can see I tried to add more CTEs into code out there but must >> these >> comment out

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-22 Thread R Smith
On 2018/03/21 9:58 PM, csanyipal wrote: I am really trying to understand how CTEs works and trying to achive my goal ( see bellow ) so I modified a little your code: ... As you can see I tried to add more CTEs into code out there but must these comment out because I get wrong Results. So for n

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-21 Thread csanyipal
David Raymond wrote > In the commented out section: > > TimeTable(DoWeek,Grade,Class_) AS > (VALUES('M'),(7),('b'),('M'),(5),('a'),('Tu'),(8),('c')... > > Shouldn't that be ...AS (VALUES ('M', 7, 'B'), ('M', 5, 'a'), ('Tu', 5, > 'c')...? > > WITH PAR(calStartDate, calEndDate) AS (SELECT '2017-09

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-21 Thread csanyipal
R Smith-2 wrote > On 2018/03/17 12:40 PM, csanyipal wrote: >> R Smith-2 wrote >>> Here is a query that will produce all days of the year (without Sundays) >>> plus their week days (and I've expanded for lesson blocks too, but you >>> will probably need to add/edit as I don't know the exact values,

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-21 Thread David Raymond
;a'), ('Tu', 5, 'c')...? -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of csanyipal Sent: Wednesday, March 21, 2018 3:58 PM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] Is it possible to CREATE TABLE from

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-21 Thread csanyipal
R Smith-2 wrote > On 2018/03/17 12:40 PM, csanyipal wrote: >> R Smith-2 wrote >>> Here is a query that will produce all days of the year (without Sundays) >>> plus their week days (and I've expanded for lesson blocks too, but you >>> will probably need to add/edit as I don't know the exact values,

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-17 Thread R Smith
On 2018/03/17 12:40 PM, csanyipal wrote: R Smith-2 wrote Here is a query that will produce all days of the year (without Sundays) plus their week days (and I've expanded for lesson blocks too, but you will probably need to add/edit as I don't know the exact values, but the method should be cle

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-17 Thread Keith Medcalf
sers- >boun...@mailinglists.sqlite.org] On Behalf Of csanyipal >Sent: Saturday, 17 March, 2018 04:40 >To: sqlite-users@mailinglists.sqlite.org >Subject: Re: [sqlite] Is it possible to CREATE TABLE from other >tables in a complex way? > >R Smith-2 wrote >> Here is a query that will

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-17 Thread csanyipal
R Smith-2 wrote > Here is a query that will produce all days of the year (without Sundays) > plus their week days (and I've expanded for lesson blocks too, but you > will probably need to add/edit as I don't know the exact values, but the > method should be clear). You can JOIN this to the other

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-11 Thread csanyipal
R Smith-2 wrote > This seems like a whole assignment, and we are not in the habit to do > assignments for people, > > BUT, we can get you started down the path. > > You should know how to do all you are asking by simple RDBMS mechanics, > except maybe how to initialize a table with all dates an

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-11 Thread Simon Slavin
On 11 Mar 2018, at 12:05pm, Csányi Pál wrote: > Columns are: id,date,D,lb,g,c,lp,ld,re > > where D is a Day name in Week, > lb is the number of the Lesson Block hour, > g is the grade of a school class, > c is the name of the school class, > lp is LessonPlan, > ld is LessonDiary, > re is Reminde

Re: [sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-11 Thread R Smith
This seems like a whole assignment, and we are not in the habit to do assignments for people, BUT, we can get you started down the path. You should know how to do all you are asking by simple RDBMS mechanics, except maybe how to initialize a table with all dates and other things pre-populated

[sqlite] Is it possible to CREATE TABLE from other tables in a complex way?

2018-03-11 Thread Csányi Pál
Hi, is it possible to create a table from other tables with the following conditions? Note! My goal is to create that table 'Hours' with a say 362 records and after that to update those records with UPDATE sql commands. That is, I don't want to INSERT in that table any more records, but just UPDA