Академический Документы
Профессиональный Документы
Культура Документы
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Database changed
+--------+----------+-------+---------+
+--------+----------+-------+---------+
+--------+----------+-------+---------+
3 rows in set (0.00 sec)
+--------+----------+-------+---------+------+------+
+--------+----------+-------+---------+------+------+
+--------+----------+-------+---------+------+------+
ERROR 1292 (22007): Incorrect date value: '1-JAN-2000' for column 'DOB' at row 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where emp_id=1' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where emp_id=2' at line 1
+--------------+
| current_date |
+--------------+
| 2019-06-06 |
+--------------+
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+----------------------+
| (current_date-HD)/12 |
+----------------------+
| 3340.9166666666665 |
| 14990.5 |
+----------------------+
+--------------------+
| exp |
+--------------------+
| 3340.9166666666665 |
| 14990.5 |
+--------------------+
+-----------------------------+
| round(current_date - HD/12) |
+-----------------------------+
| 18511396 |
| 18523046 |
+-----------------------------+
-> ;
+--------+
| exp |
+--------+
| 40091 |
| 179886 |
+--------+
+-------------------------------+
| round((current_date - HD)/12) |
+-------------------------------+
| 3341 |
| 14990 |
+-------------------------------+
+------------------------------+
| round((current_date - HD)/7) |
+------------------------------+
| 5727 |
| 25698 |
+------------------------------+
+----------------------+
| (current_date - DOB) |
+----------------------+
| 190505 |
| 290085 |
+----------------------+
+-------------------------+
| (current_date - DOB)/12 |
+-------------------------+
| 15875.416666666666 |
| 24173.75 |
+-------------------------+
+------------------+
| current_date-DOB |
+------------------+
| 190505 |
| 290085 |
+------------------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '[DOB] from new' at line 1
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'datediff'
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'datediff'
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'DATEDIFF'
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'DATEDIFF'
+-----------------------------------------------+
| timestampdiff(year,'2000-12-12','2018-10-10') |
+-----------------------------------------------+
| 17 |
+-----------------------------------------------+
| timestampdiff(year,DOB,current_date) |
+--------------------------------------+
| 19 |
| 29 |
+--------------------------------------+
+-----------------------------------------------+
| timestampdiff(year,'2000-12-12','2018-12-12') |
+-----------------------------------------------+
| 18 |
+-----------------------------------------------+
+------------------------------------------------+
| timestampdiff(month,'2000-12-12','2018-12-12') |
+------------------------------------------------+
| 216 |
+------------------------------------------------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'days,'2000-12-12','2018-12-12')' at line 1
+----------------------------------------------+
| timestampdiff(day,'2000-12-12','2018-12-12') |
+----------------------------------------------+
| 6574 |
+----------------------------------------------+
+----------------------------------------+
| timestampdiff(year,'DOB',current_date) |
+----------------------------------------+
| NULL |
| NULL |
+----------------------------------------+
+----------------------------------------+
| timestampdiff(year,(DOB),current_date) |
+----------------------------------------+
| 19 |
| 29 |
+----------------------------------------+
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+--------------------------------------+
| timestampdiff(year,DOB,current_date) |
+--------------------------------------+
| 19 |
| 29 |
+--------------------------------------+
+---------------------------------------+
| timestampdiff(month,DOB,current_date) |
+---------------------------------------+
| 233 |
| 348 |
+---------------------------------------+
+--------------------------------------+
| timestampdiff(month,HD,CURRENT_DATE) |
+--------------------------------------+
| 48 |
| 214 |
+--------------------------------------+
+-------------------------------------+
| timestampdiff(YEAR,HD,CURRENT_DATE) |
+-------------------------------------+
| 4|
| 17 |
+-------------------------------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+-------------------------------------+
| timestampdiff(YEAR,HD,CURRENT_DATE) |
+-------------------------------------+
| 4|
| 17 |
+-------------------------------------+
+-------------------------------------+
| timestampdiff(YEAR,HD,CURRENT_DATE) |
+-------------------------------------+
| 4|
| 2|
+-------------------------------------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'FROM new' at line 1
+--------------------------------------------+
| ROUND(timestampdiff(YEAR,HD,CURRENT_DATE)) |
+--------------------------------------------+
| 4|
| 2|
+--------------------------------------------+
+-------------------------------------+
| timestampdiff(YEAR,HD,CURRENT_DATE) |
+-------------------------------------+
| 4|
| 2|
+-------------------------------------+
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+--------------------------------------+
| timestampdiff(month,HD,CURRENT_DATE) |
+--------------------------------------+
| 48 |
| 24 |
+--------------------------------------+
'> ;
'> ;
'> update new set name=elias where HD='201
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '2015-05-15';
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+----------+
| sysdate |
+----------+
| sysdate |
+----------+
+---------------------+
| sysdate() |
+---------------------+
| 2019-06-06 07:04:02 |
+---------------------+
+-------+------------+------------+
| name | DOB | HD |
+-------+------------+------------+
+-------+------------+------------+
+-------+------------+------------+------+
+-------+------------+------------+------+
+-------+------------+------------+------+
+-------+------------+------------+------+
+-------+------------+------------+------+
+-------+------------+------------+--------+
+-------+------------+------------+--------+
+-------+------------+------------+--------+
+-------+------------+------------+------+
+-------+------------+------------+------+
+-------+------------+------------+------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where name='Elias'' at line 1
mysql> update new set sal=10000 where name='Elias';
+-------+------------+------------+--------+
+-------+------------+------------+--------+
+-------+------------+------------+--------+
4 rows in set (0.00 sec)
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
+-------+
| name |
+-------+
| Elias |
| Ron |
| rohit |
| akash |
+-------+
+-------+--------+
| name | sal |
+-------+--------+
| Elias | 10000 |
| Ron | 20000 |
| rohit | 50000 |
| akash | 100000 |
+-------+--------+
ERROR:
No query specified
+------------+
| avg(sal) |
+------------+
| 45000.0000 |
+------------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where sal>avg(sal)' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where (sal>avg(sal))' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where (sal>avg(sal))' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where sal>avg(sal)' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where sal>avg(sal)' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where sal>avg(sal)' at line 1
mysql> select avg(sal),d_id from new group by d_id where sal>avg(sal);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'where sal>avg(sal)' at line 1
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
+-------+------------+------------+--------+------+
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'SELECT MAX(avgsal) FROM (' at line 1
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ') AS avgsal FROM employee GROUP BY deptno' at
line 1
-> ) AS query1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'FROM employee GROUP BY deptno
) AS query1' at line 2
-> (
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '' at line 3
mysql> select max(avg(sal)) from (select avg(sal) as avgsal from new group by d_id);
ERROR 1248 (42000): Every derived table must have its own alias
mysql> select max(avg(sal)) from (select avg(sal) as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal)) from (select avg(sal),d_id as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal)) from (select avg(sal),sal as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal)) from (select sal,avg(sal) as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal)),sal from (select avg(sal) as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal))from (select avg(sal) as avgsal from new group by d_id) as q1 new;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'new' at line 1
ERROR 1248 (42000): Every derived table must have its own alias
mysql> select max(avg(sal))from (select avg(sal) as avgsal from new group by d_id) as q1;
mysql> select sal,max(avg(sal))from (select avg(sal) as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal))from (select avg(sal) as avgsal from new group by d_id) as q1;
mysql> select max(avg(sal))from (select avg(sal),d_id as avgsal from new group by d_id) as q1;
mysql> select avg(sal) from new group by d_id order by avg(sal) desc limit 1;
+------------+
| avg(sal) |
+------------+
| 75000.0000 |
+------------+
mysql> select avg(sal) from new group by d_id order by avg(sal) desc limit 2;
+------------+
| avg(sal) |
+------------+
| 75000.0000 |
| 15000.0000 |
+------------+
mysql> select avg(sal) from new group by d_id order by avg(sal) desc limit 3;
+------------+
| avg(sal) |
+------------+
| 75000.0000 |
| 15000.0000 |
+------------+
mysql> select avg(sal),d_id from new group by d_id order by avg(sal) desc limit 3;
+------------+------+
| avg(sal) | d_id |
+------------+------+
| 75000.0000 | 56 |
| 15000.0000 | 112 |
+------------+------+
mysql> select avg(sal),d_id from new group by d_id order by avg(sal) desc limit 1;
+------------+------+
| avg(sal) | d_id |
+------------+------+
| 75000.0000 | 56 |
+------------+------+
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-> where
Database changed
-> where
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'vmob IN(
-> where
-> vname,vmob =(
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'vmob =(
-> from
-> (select productcode, max(price) as m_price -- Swap this for min(price) for minimum
+-----------+--------------+
| vname | lowest_price |
+-----------+--------------+
| amzon | 200 |
| shopclues | 250 |
| ebay | 350 |
| flipcart | 700 |
+-----------+--------------+
+------+--------+
| p_id | name |
+------+--------+
| 1 | tees |
| 2 | mobile |
| 3 | books |
| 4 | TV |
| 5 | watch |
+------+--------+
+------+-----------+--------+
+------+-----------+--------+
| 10 | amzon | 992134 |
| 20 | shopclues | 435566 |
| 30 | flipcart | 762956 |
| 40 | ebay | 905466 |
+------+-----------+--------+
| p_id | v_id | SP |
+------+------+-------+
| 5 | 10 | 200 |
| 5 | 20 | 300 |
| 5 | 40 | 400 |
| 1 | 10 | 200 |
| 1 | 20 | 300 |
| 2 | 30 | 700 |
| 2 | 40 | 1000 |
| 3 | 20 | 250 |
| 3 | 40 | 350 |
| 4 | 10 | 30500 |
+------+------+-------+
+-----------+--------------+
| vname | lowest_price |
+-----------+--------------+
| amzon | 200 |
| shopclues | 250 |
| ebay | 350 |
| flipcart | 700 |
+-----------+--------------+
+-----------+---------------+--------------+
+-----------+---------------+--------------+
| amzon | 30500 | TV |
+-----------+---------------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
| TV | amzon | 30500 |
+--------+-----------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
| TV | amzon | 30500 |
+--------+-----------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
+--------+-----------+--------------+
| TV | amzon | 30500 |
+--------+-----------+--------------+
+--------+-----------+--------+--------------+
+--------+-----------+--------+--------------+
+--------+-----------+--------+--------------+