karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 97 of 143

Python code to print common characters of two Strings in alphabetical order

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 1K+ Views

Two user input strings are given, our task is to print all the common characters in alphabetical order.ExampleInput: string1: python string2: program Output: opExplanationThe letters that are common between the two strings are o (1 times), p (1 time)AlgorithmStep 1: first we take two input string. Step 2: next we will do to convert these two strings into counter dictionary. Step 3: Now find common elements between two strings using intersection ( ) property. Step 4: Resultant will also be a counter dictionary having common elements as keys and their common frequencies as value. Step 5: Use elements () method ...

Read More

String slicing in Python to rotate a string

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 5K+ Views

A string is given, our task is to slicing the string into two way. One is clockwise and another anticlockwise.1. Left (Or anticlockwise) rotate the given string by d elements (where d pythonprogram Left Rotation: thonprogrampy Right Rotation: ampythonprogr

Read More

How can we update any value in MySQL view as we can update the values in MySQL table?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 521 Views

As we know that with the help of UPDATE statement we can update the values in MySQL table and in the similar way we can update the values in MySQL views. The syntax of UPDATE statement would be the same except at the place of table name we have to provide the name of the view. We are taking the data as follows from a view named ‘Info’ to illustrate the above concept −mysql> Select * from Info; +------+---------+------------+ | Id | Name | Subject | +------+---------+------------+ | 101 | YashPal ...

Read More

What are the limitations of using MySQL views?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 2K+ Views

In spite of various benefits of using views there are following limitations on using MySQL views − Can’t create an index of views − In MySQL, we cannot create an index on views. It is because indexes are not utilized when we query data against the views. MySQL invalidates the view − Suppose, if we drop or rename tables to which a view references, rather than issuing an error MySQL invalidate the view. We can use the CHECK TABLE statement to check whether the view is valid or not. MySQL views cannot be updateable in some situations − Actually, the ...

Read More

How can we see the information on triggers order in case of multiple triggersnfor same event and action time?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 127 Views

It can be done with the help of the following query −mysql> SELECT trigger_name,action_order FROM INFORMATION_SCHEMA.triggers WHERE TRIGGER_SCHEMA = 'query' ORDER BY event_object_table,action_timing,event_manipulation; +------------------------------+--------------+ | trigger_name | action_order | +------------------------------+--------------+ | studentdetail_before_update | 1 | | studentdetail_before_update2 | 2 | +------------------------------+--------------+ 2 rows in set (0.10 sec)The above result set shows the order of multiple triggers created on the same event and action time in the database ‘query’.

Read More

How can we check the current MySQL transaction isolation level?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 3K+ Views

By executing SELECT @@TX_ISOLATION command we can check the current MySQL transaction isolation level.Examplemysql> SELECT @@TX_ISOLATION; +-----------------+ | @@TX_ISOLATION | +-----------------+ | REPEATABLE-READ | +-----------------+ 1 row in set (0.00 sec)

Read More

How can I convert the epoch stored in MySQL table into readable dates?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 196 Views

To illustrate it we are using the following example of a table named ‘vistors’ which have the epoch as follows −mysql> Create table visitors(userid int not null, name varchar(20), epoch int NOT NULL); Query OK, 0 rows affected (0.42 sec) mysql> Insert into visitors Values(1, 'Gaurav', 1358658942); Query OK, 1 row affected (0.04 sec) mysql> Insert into visitors Values(2, 'Raman', 1358659585); Query OK, 1 row affected (0.04 sec) mysql> Select userid, name, FROM_UNIXTIME(epoch) from visitors; +--------+--------+----------------------+ | userid | name | FROM_UNIXTIME(epoch) | +--------+--------+----------------------+ | 1 | Gaurav | 2013-07-24 16:05:42 | | 2 | Raman | 2013-07-24 16:16:25 | +--------+--------+----------------------+ 2 rows in set (0.00 sec)

Read More

What is the difference between = and: = assignment operators?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 902 Views

Actually, they both are assignment operator and used to assign values but the significant difference between them is as follows −= operator assigns a value either as a part of the SET statement or as a part of the SET clause in an UPDATE statement, in any other case = operator is interpreted as a comparison operator. On the other hand, := operator assigns a value and it is never interpreted as a comparison operator.mysql> Update estimated_cost1 SET Tender_value = '8570.000' where id = 2; Query OK, 1 row affected (0.06 sec) Rows matched: 1 Changed: 1 Warnings: 0 ...

Read More

How can we use MySQL SUM() function with HAVING clause?

karthikeya Boyini
karthikeya Boyini
Updated on 22-Jun-2020 3K+ Views

By using MySQL SUM() function with the HAVING clause, it filters the result based on a specific condition given after the HAVING clause. To understand the above concept, consider an ‘employee_tbl’ table, which is having the following records −mysql> SELECT * FROM employee_tbl; +------+------+------------+--------------------+ | id   | name | work_date  | daily_typing_pages | +------+------+------------+--------------------+ | 1    | John | 2007-01-24 |        250         | | 2    | Ram  | 2007-05-27 |        220         | | 3    | Jack | 2007-05-06 |       ...

Read More

How can we distinguish between MySQL IFNULL() and NULLIF() functions?

karthikeya Boyini
karthikeya Boyini
Updated on 20-Jun-2020 3K+ Views

Actually, both MySQL IFNULL() and NULLIF() functions are having an almost same syntax as given below −The syntax of IFNULL()IFNULL(expression1, expression2)The syntax of NULLIF()NULLIF(expression1, expression2)They can be distinguished in the way they return the first argument as result. IFNULL() function will return the first argument as a result if it is not NULL and NULLIF() function will return the first argument as a result if both the arguments are not same.mysql> Select IFNULL('Ram', 'Shyam'); +-----------------------+ | IFNULL('Ram', 'Shyam') | +-----------------------+ | Ram                   | +-----------------------+ 1 row in set (0.00 sec) mysql> Select ...

Read More
Showing 961–970 of 1,421 articles
« Prev 1 95 96 97 98 99 143 Next »
Advertisements