Notes
![]() ![]() Notes - notes.io |
+-------------+---------+
| SUM(AMOUNT) | MONTH |
+-------------+---------+
| 8000 | APRIL |
| 2080428 | JANUARY |
| 10000 | MARCH |
| 1053714 | OCTOBER |
+-------------+---------+
4 rows in set, 12 warnings (0.01 sec)
select NAME , IF( C_ID IN (SELECT CUST_ID FROM DEPOSITOR) ,'YES','NO') AS ISDEPOSITOR FROM CUSTOMER WHERE GENDER='f';
+----------+-------------+
| NAME | ISDEPOSITOR |
+----------+-------------+
| haritha | YES |
| himani | YES |
| saritha | YES |
| sachitra | YES |
| yogitha | YES |
| radhika | NO |
+----------+-------------+
6 rows in set (0.00 sec)
CREATE VIEW BRRANK2 AS SELECT BR_NAME , SUM(BALANCE) , CASE WHEN SUM(BALANCE) >=10000 THEN '1' WHEN SUM(BALANCE) >=8000 AND SUM(BALANCE) < 10000 THEN '2' ELSE '3'END AS RANK FROM ACCOUNT GROUP BY BR_NAME;
Query OK, 0 rows affected (0.04 sec)
mysql> select * FROM BRRANK2;
+---------+--------------+------+
| BR_NAME | SUM(BALANCE) | RANK |
+---------+--------------+------+
| zone1 | 13000 | 1 |
| zone2 | 10000 | 1 |
| zone3 | 6000 | 3 |
| zone4 | 10000 | 1 |
| zone6 | 6000 | 3 |
| zone7 | 9000 | 2 |
| zone8 | 8000 | 2 |
| zone9 | 7000 | 3 |
+---------+--------------+------+
8 rows in set (0.00 sec)
select s1.P_NO,s1.DATE,s2.DATE,CASE WHEN DATEDIFF(s2.DATE,s1.DATE) <=365 THEN 'FIRST YEAR' WHEN DATEDIFF(s2.DATE,s1.DATE) <=730 AND DATEDIFF(s2.DATE,s1.DATE) >365 THEN 'SECOND YEAR' WHEN DATEDIFF(s2.DATE,s1.DATE) <=1095 AND DATEDIFF(s2.DATE,s1.DATE) > 730 THEN 'THIRD YEAR' ELSE 'DEFAULTER' END AS STATUS from PAYMENT as s1,PAYMENT as s2 where s1.P_NO=s2.P_NO and s2.DATE>s1.DATE;
+------+------------+------------+-------------+
| P_NO | DATE | DATE | STATUS |
+------+------------+------------+-------------+
| p1 | 2011-01-09 | 2012-10-25 | SECOND YEAR |
| p1 | 2011-10-08 | 2012-10-25 | SECOND YEAR |
| p1 | 2011-10-11 | 2012-10-25 | SECOND YEAR |
| p1 | 2011-03-11 | 2012-10-25 | SECOND YEAR |
| p1 | 2012-04-11 | 2012-10-25 | FIRST YEAR |
| p1 | 2011-01-09 | 2011-10-08 | FIRST YEAR |
| p1 | 2011-03-11 | 2011-10-08 | FIRST YEAR |
| p2 | 2000-01-09 | 2011-10-09 | DEFAULTER |
| p1 | 2011-01-09 | 2011-10-11 | FIRST YEAR |
| p1 | 2011-10-08 | 2011-10-11 | FIRST YEAR |
| p1 | 2011-03-11 | 2011-10-11 | FIRST YEAR |
| p1 | 2011-01-09 | 2011-03-11 | FIRST YEAR |
| p2 | 2000-01-09 | 2012-03-11 | DEFAULTER |
| p2 | 2011-10-09 | 2012-03-11 | FIRST YEAR |
| p1 | 2011-01-09 | 2012-04-11 | SECOND YEAR |
| p1 | 2011-10-08 | 2012-04-11 | FIRST YEAR |
| p1 | 2011-10-11 | 2012-04-11 | FIRST YEAR |
| p1 | 2011-03-11 | 2012-04-11 | SECOND YEAR |
+------+------------+------------+-------------+
18 rows in set (0.00 sec)
UPDATE CUSTOMER_COPY SET STREET='NH17B' WHERE NAME IN (SELECT DISTINCT C.NAME FROM CUSTOMER C JOIN (SELECT SUM(P.AMOUNT) AS SUM,B.CUST_ID AS
-> C_ID FROM BORROWER B JOIN PAYMENT P ON P.L_NO = B.LOAN_NO GROUP BY B.CUST_ID
-> HAVING SUM >= 10000) R ON R.C_ID = C.C_ID);
Query OK, 2 rows affected (0.04 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> SELECT * from CUSTOMER_COPY;
+------+----------+------------+--------------+--------+
| C_ID | NAME | STREET | CITY | GENDER |
+------+----------+------------+--------------+--------+
| c1 | haritha | NH17B | machlipatnam | f |
| c2 | himani | NH17B | machlipatnam | f |
| c3 | shankar | kadamba | eluru | m |
| c4 | saritha | kadamba | eluru | f |
| c5 | sachitra | saraswathi | nandigama | f |
| c6 | yogitha | kaveri | hyderabad | f |
| c7 | radhika | kaveri | hyderabad | f |
| c8 | ramu | azad | Vijayawada | m |
+------+----------+------------+--------------+--------+
8 rows in set (0.00 sec)
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team