Translate

Friday 1 October 2021

Running SQL File sql videos in Telugu 23

 https://youtu.be/LX9nFrcKxDQ

------------------------------------------
Function Description
ASCII Returns the ASCII value for the specific character

SELECT ASCII(name) AS "ASCII code of name first letter"
FROM emp;
-----------------------
ASCII,CHAR_LENGTH Returns the length of a string (in characters)

SELECT CHAR_LENGTH("vlr training") AS 'Length of string';
SELECT CHAR_LENGTH(name) AS 'Length of name' from emp;

-----------------------------

CHARACTER_LENGTH Returns the length of a string (in characters)
SELECT CHARACTER_LENGTH("vlr training") AS 'Length of string';
SELECT CHARACTER_LENGTH(name) AS 'Length of name' from emp;
--------------------------
CONCAT functions in sql Adds two or more expressions together
SELECT CONCAT("vlr ", "training ", "sql ", "videos") AS ConcatenatedVlr;

SELECT CONCAT(name, " has ", age, "Sal is ", sal) AS EmpDetails
FROM emp;
-----------------------------------
Setting environment for using XAMPP for Windows.
Mounika@MOUNIKA-PC c:\xampp
# ram.cmd
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.4.18-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use vlrinst;
Database changed
MariaDB [vlrinst]> select ascii('A') as 'values';
+--------+
| values |
+--------+
|     65 |
+--------+
1 row in set (0.001 sec)

MariaDB [vlrinst]> select ascii(name) as 'value' from emp;;
+-------+
| value |
+-------+
|   118 |
|   112 |
|   109 |
|   114 |
|    97 |
|   104 |
|   112 |
|   112 |
|   112 |
+-------+
9 rows in set (0.001 sec)

ERROR: No query specified

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
| 10 | venkat  | kphb      |   35 | 30000 |
| 11 | praveen | pune      |   28 | 35000 |
| 12 | mounika | hyderabad |   22 | 39000 |
| 13 | revathi | jntu      |   26 | 20000 |
| 14 | anji    | gutta     |   28 | 20000 |
| 15 | harika  | lb nagar  |   26 | 30100 |
| 16 | praveen | jntu      |   33 |   100 |
| 17 | pandu   | munipeda  |   35 | 30300 |
| 18 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.002 sec)

MariaDB [vlrinst]> select char_length ('vlr Training')  as length;
+--------+
| length |
+--------+
|     12 |
+--------+
1 row in set (0.028 sec)

MariaDB [vlrinst]> select char_length (name)  as length from emp;
+--------+
| length |
+--------+
|      6 |
|      7 |
|      7 |
|      7 |
|      4 |
|      6 |
|      7 |
|      5 |
|      5 |
+--------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select char_length (loc)  as length from emp;
+--------+
| length |
+--------+
|      4 |
|      4 |
|      9 |
|      4 |
|      5 |
|      8 |
|      4 |
|      8 |
|      4 |
+--------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select char_length (sal)  as length from emp;
+--------+
| length |
+--------+
|      5 |
|      5 |
|      5 |
|      5 |
|      5 |
|      5 |
|      3 |
|      5 |
|      5 |
+--------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select char_length (id)  as length from emp;
+--------+
| length |
+--------+
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
+--------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select CHARACTER_LENGTH(id)  as length from emp;
+--------+
| length |
+--------+
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
|      2 |
+--------+
9 rows in set (0.000 sec)

MariaDB [vlrinst]> select CHARACTER_LENGTH(name)  as length from emp;
+--------+
| length |
+--------+
|      6 |
|      7 |
|      7 |
|      7 |
|      4 |
|      6 |
|      7 |
|      5 |
|      5 |
+--------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> SELECT CHARACTER_LENGTH("vlr training") AS 'Length of string';
+------------------+
| Length of string |
+------------------+
|               12 |
+------------------+
1 row in set (0.000 sec)

MariaDB [vlrinst]> select concact("vlr"," training") as name;
ERROR 1305 (42000): FUNCTION vlrinst.concact does not exist
MariaDB [vlrinst]> select concat("vlr"," training") as name;
+--------------+
| name         |
+--------------+
| vlr training |
+--------------+
1 row in set (0.027 sec)

MariaDB [vlrinst]> select * from emp;
+----+---------+-----------+------+-------+
| id | name    | loc       | age  | sal   |
+----+---------+-----------+------+-------+
| 10 | venkat  | kphb      |   35 | 30000 |
| 11 | praveen | pune      |   28 | 35000 |
| 12 | mounika | hyderabad |   22 | 39000 |
| 13 | revathi | jntu      |   26 | 20000 |
| 14 | anji    | gutta     |   28 | 20000 |
| 15 | harika  | lb nagar  |   26 | 30100 |
| 16 | praveen | jntu      |   33 |   100 |
| 17 | pandu   | munipeda  |   35 | 30300 |
| 18 | pandu   | pune      |   23 | 39300 |
+----+---------+-----------+------+-------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]> select concat(name ,' staying in ',loc, ' and earnings are ',sal) as info
    -> from emp;
+-----------------------------------------------------+
| info                                                |
+-----------------------------------------------------+
| venkat staying in kphb and earnings are 30000       |
| praveen staying in pune and earnings are 35000      |
| mounika staying in hyderabad and earnings are 39000 |
| revathi staying in jntu and earnings are 20000      |
| anji staying in gutta and earnings are 20000        |
| harika staying in lb nagar and earnings are 30100   |
| praveen staying in jntu and earnings are 100        |
| pandu staying in munipeda and earnings are 30300    |
| pandu staying in pune and earnings are 39300        |
+-----------------------------------------------------+
9 rows in set (0.001 sec)

MariaDB [vlrinst]>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.