github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/function/func_datetime_weekday.result (about)

     1  SELECT weekday(date('2007-02-03 03:42:24'));
     2  weekday(date('2007-02-03 03:42:24'))
     3  5
     4  SELECT weekday(date('2023-11-08 13:42'));
     5  weekday(date('2023-11-08 13:42'))
     6  2
     7  SELECT weekday(NULL);
     8  weekday(NULL)
     9  null
    10  create table t1(a tinyint, b SMALLINT, c bigint, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19), i DATE, k datetime, l TIMESTAMP, m char(255), n varchar(255));
    11  insert into t1 values(1, 1, 2, 43, 5, 35.5, 31.133, 14.314, "2012-03-10", "2012-03-12 10:03:12", "2022-03-12 13:03:12", "ab23c", "d5cf");
    12  insert into t1 values(71, 1, 2, 34, 5, 5.5, 341.13, 15.314, "2012-03-22", "2013-03-12 10:03:12", "2032-03-12 13:04:12", "abr23c", "3dcf");
    13  insert into t1 values(1, 1, 21, 4, 54, 53.5, 431.13, 14.394, "2011-03-12", "2015-03-12 10:03:12", "2002-03-12 13:03:12", "afbc", "dct5f");
    14  insert into t1 values(1, 71, 2, 34, 5, 5.5, 31.313, 124.314, "2012-01-12", "2019-03-12 10:03:12", "2013-03-12 13:03:12", "3abd1c", "dcvf");
    15  select weekday(a),weekday(b),weekday(c),weekday(d),weekday(e),weekday(f) from t1;
    16  invalid argument function weekday, bad value [TINYINT]
    17  select weekday(g),weekday(h),weekday(i),weekday(k),weekday(l),weekday(m),weekday(n) from t1;
    18  invalid argument function weekday, bad value [DOUBLE]
    19  drop table t1;
    20  SELECT weekday("2015-09-03") as weekday;
    21  weekday
    22  3
    23  SELECT weekday('20150904') as weekday;
    24  weekday
    25  4
    26  SELECT weekday(1340124) as weekday;
    27  invalid argument function weekday, bad value [BIGINT]
    28  SELECT weekday(0.45133) as weekday;
    29  invalid argument function weekday, bad value [DECIMAL64]
    30  SELECT weekday(10) as weekday;
    31  invalid argument function weekday, bad value [BIGINT]
    32  SELECT weekday(1=1) as weekday;
    33  invalid argument function weekday, bad value [BOOL]
    34  SELECT weekday('2015-09-30') as weekday;
    35  weekday
    36  2
    37  SELECT weekday('2015-0') as weekday;
    38  invalid argument parsedate, bad value 2015-0
    39  SELECT weekday('2015-09.30 12') as weekday;
    40  invalid argument parsedate, bad value 2015-09.30 12
    41  SELECT weekday('2015-09-26 08:09:22') AS weekday;
    42  weekday
    43  5
    44  select weekday("2020-08");
    45  invalid argument parsedate, bad value 2020-08
    46  select weekday("0000-00-00");
    47  invalid argument parsedate, bad value 0000-00-00
    48  select weekday("-0001-03-03");
    49  invalid argument parsedate, bad value -0001-03-03
    50  select weekday("10000-03-02");
    51  invalid argument parsedate, bad value 10000-03-02
    52  select weekday("2021-13-09");
    53  invalid argument parsedate, bad value 2021-13-09
    54  select weekday("2020-10-32");
    55  invalid argument parsedate, bad value 2020-10-32
    56  SELECT weekday("2015-09-10")- weekday("2016-04-24");
    57  weekday("2015-09-10")- weekday("2016-04-24")
    58  -3
    59  SELECT weekday("2015-09-10")+ weekday("2016-04-24");
    60  weekday("2015-09-10")+ weekday("2016-04-24")
    61  9
    62  SELECT weekday("2015-09-10")*weekday("2016-04-24");
    63  weekday("2015-09-10")*weekday("2016-04-24")
    64  18
    65  SELECT weekday("2015-09-10")/weekday("2016-04-24");
    66  weekday("2015-09-10")/weekday("2016-04-24")
    67  0.5000
    68  SELECT weekday("2015-09-10")>weekday("2016-04-24");
    69  weekday("2015-09-10")>weekday("2016-04-24")
    70  false
    71  SELECT weekday("2015-09-10")<weekday("2016-04-24");
    72  weekday("2015-09-10")<weekday("2016-04-24")
    73  true
    74  SELECT weekday("2015-09-10")=weekday("2016-04-24");
    75  weekday("2015-09-10")=weekday("2016-04-24")
    76  false
    77  SELECT weekday("2015-09-10")<>weekday("2016-04-24");
    78  weekday("2015-09-10")<>weekday("2016-04-24")
    79  true
    80  SELECT weekday("2015-09-10")!=weekday("2016-04-24");
    81  weekday("2015-09-10")!=weekday("2016-04-24")
    82  true
    83  CREATE TABLE Product(Product_id INT,  Product_name VARCHAR(100) NOT NULL,Buying_price DECIMAL(13, 2) NOT NULL,Selling_price DECIMAL(13, 2) NOT NULL,Selling_Date Date NOT NULL,PRIMARY KEY(Product_id));
    84  INSERT INTO  Product(Product_name, Buying_price, Selling_price, Selling_Date) VALUES ('Audi Q8', 10000000.00, 15000000.00, '2018-01-26' ),('Volvo XC40', 2000000.00, 3000000.00, '2018-04-20' ),('Audi A6', 4000000.00, 5000000.00, '2018-07-25' ),('BMW X5', 5000500.00, 7006500.00, '2018-10-18'  ),('Jaguar XF', 5000000, 7507000.00, '2019-01-27'  ),('Mercedes-Benz C-Class', 4000000.00, 6000000.00, '2019-04-01'  ),('Jaguar F-PACE', 5000000.00, 7000000.00, '2019-12-26'  ),('Porsche Macan', 6500000.00, 8000000.00, '2020-04-16' ) ;
    85  invalid input: invalid default value for column 'product_id'
    86  SELECT  weekday (Selling_Date) weekday,  COUNT(Product_id) Product_Sold FROM Product GROUP BY weekday (Selling_Date) ORDER BY weekday (Selling_Date);
    87  weekday	Product_Sold
    88  DROP TABLE Product;
    89  drop table if exists t1;
    90  create table t1(a INT,  b date);
    91  insert into t1 select weekday("2012-10-12"), "2012-10-12";
    92  insert into t1 select weekday("2004-04-24"), "2004-04-24";
    93  insert into t1 select weekday("2008-12-04"), "2008-12-04";
    94  select * from t1;
    95  a	b
    96  4	2012-10-12
    97  5	2004-04-24
    98  3	2008-12-04
    99  drop table t1;
   100  drop table if exists t1;
   101  create table t1(a INT,  b date);
   102  insert into t1 values(1, "2012-10-12"),(2, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
   103  select * from t1 where weekday(b)<>0;
   104  a	b
   105  1	2012-10-12
   106  2	2004-04-24
   107  3	2008-12-04
   108  4	2012-03-23
   109  drop table t1;
   110  drop table if exists t1;
   111  drop table if exists t2;
   112  create table t1(a INT,  b date);
   113  create table t2(a INT,  b date);
   114  insert into t1 values(1, "2012-10-12"),(2, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
   115  insert into t2 values(1, "2013-04-30"),(2, "1994-10-04"),(3, "2018-06-04"),(4, "2012-08-12");
   116  SELECT t1.a, t2.a FROM t1 JOIN t2 ON (weekday(t1.b) <> weekday(t2.b));
   117  a	a
   118  4	1
   119  3	1
   120  2	1
   121  1	1
   122  4	2
   123  3	2
   124  2	2
   125  1	2
   126  4	3
   127  3	3
   128  2	3
   129  1	3
   130  4	4
   131  3	4
   132  2	4
   133  1	4
   134  drop table t1;
   135  drop table t2;
   136  drop table if exists t1;
   137  create table t1(a INT,  b date);
   138  insert into t1 values(1, "2012-10-12"),(1, "2012-07-12"),(2, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
   139  select b from t1 group by b having weekday(b)>0;
   140  b
   141  2012-10-12
   142  2012-07-12
   143  2004-04-24
   144  2008-12-04
   145  2012-03-23
   146  drop table t1;
   147  drop table if exists t1;
   148  create table t1(a INT,  b date);
   149  insert into t1 values(1, "2012-10-12"),(1, "2012-07-12"),(2, "2004-04-24"),(3, "2004-04-24"),(3, "2008-12-04"),(4, "2012-03-23");
   150  select distinct weekday(b) from t1;
   151  weekday(b)
   152  4
   153  3
   154  5
   155  drop table t1;
   156  CREATE TABLE t3(c1 DATE NOT NULL);
   157  INSERT INTO t3 VALUES('2000-01-01');
   158  INSERT INTO t3 VALUES('1999-12-31');
   159  INSERT INTO t3 VALUES('2000-01-01');
   160  INSERT INTO t3 VALUES('2006-12-25');
   161  INSERT INTO t3 VALUES('2008-02-29');
   162  SELECT WEEKDAY(c1) FROM t3;
   163  WEEKDAY(c1)
   164  5
   165  4
   166  5
   167  0
   168  4
   169  DROP TABLE t3;
   170  CREATE TABLE t3(c1 DATETIME NOT NULL);
   171  INSERT INTO t3 VALUES('2000-01-01');
   172  INSERT INTO t3 VALUES('1999-12-31');
   173  INSERT INTO t3 VALUES('2000-01-01');
   174  INSERT INTO t3 VALUES('2006-12-25');
   175  INSERT INTO t3 VALUES('2008-02-29');
   176  SELECT WEEKDAY(c1) FROM t3;
   177  WEEKDAY(c1)
   178  5
   179  4
   180  5
   181  0
   182  4
   183  DROP TABLE t3;
   184  CREATE TABLE t3(c1 TIMESTAMP NOT NULL);
   185  INSERT INTO t3 VALUES('2000-01-01');
   186  INSERT INTO t3 VALUES('1999-12-31');
   187  INSERT INTO t3 VALUES('2000-01-01');
   188  INSERT INTO t3 VALUES('2006-12-25');
   189  INSERT INTO t3 VALUES('2008-02-29');
   190  SELECT WEEKDAY(c1) FROM t3;
   191  WEEKDAY(c1)
   192  5
   193  4
   194  5
   195  0
   196  4
   197  DROP TABLE t3;