Articles on Trending Technologies

Technical articles with clear explanations and examples

Do we have any lower and upper limit of base in MySQL CONV() function? What happens if out of limit base is provided in CONV() function?

Ankith Reddy
Ankith Reddy
Updated on 04-Feb-2020 154 Views

The base must be greater than 2 and less than 36 i.e. the lower limit of a base is 2 and the upper limit is 36. It is applied to both from_base and to_base values. If in case we provide out of limit values of the base then MySQL returns NULL as the output. Following example will demonstrate it −Examplemysql> Select CONV(10,10,38); +----------------+ | CONV(10,10,38) | +----------------+ | NULL           | +----------------+ 1 row in set (0.00 sec) mysql> Select CONV(10,72,2); +---------------+ | CONV(10,72,2) | +---------------+ | NULL          | +---------------+ 1 row in set (0.00 sec) mysql> Select CONV(10,10,1); +---------------+ | CONV(10,10,1) | +---------------+ | NULL          | +---------------+ 1 row in set (0.00 sec)

Read More

How can we import data from a text file having names of the columns in first row?

Abhinaya
Abhinaya
Updated on 04-Feb-2020 468 Views

Sometimes, the input text file has the names of the columns in the first row and to import data from such kind of text file to MySQL table we need to use ‘IGNORE ROWS’ option. To illustrate it we are using the following example −ExampleFollowings are the comma separated values in A.txt file −Id, Name, Country, Salary 100, ”Ram”, ”INDIA”, 25000 101, ”Mohan”, ”INDIA”, 28000We want to import this data into the following file named employee3_tbl −mysql> Create table employee3_tbl(Id Int, Name Varchar(20), Country Varchar(20), Salary Int); Query OK, 0 rows affected (0.1 sec)Now, the transfer of data from a ...

Read More

How LOCATE() function can be used with MySQL WHERE clause?

Arjun Thakur
Arjun Thakur
Updated on 04-Feb-2020 787 Views

When we use LOCATE() function with MySQL WHERE clause, we need to provide the substring as first argument and column name of the table as the second argument along with a comparison operator. Following is an example using ‘Student’ table to demonstrate it −ExampleSuppose we have the following values in ‘Student’ table −mysql> Select * from Student; +------+---------+---------+-----------+ | Id   | Name    | Address | Subject   | +------+---------+---------+-----------+ | 1    | Gaurav  | Delhi   | Computers | | 2    | Aarav   | Mumbai  | History   | | 15   | Harshit ...

Read More

What is the use of MySQL BINARY keyword while performing string comparison?

karthikeya Boyini
karthikeya Boyini
Updated on 04-Feb-2020 1K+ Views

When MySQL performs string comparison then it is not case-sensitive but with the help of BINARY keyword, MySQL can perform case-sensitive string comparison. It is because BINARY keyword instructs MySQL to compare the characters in the string using their underlying ASCII values rather than just their letters. It can be illustrated with the following example from table ‘Student_info’ having the following data −mysql> Select * from student_info; +------+---------+------------+------------+ | id   | Name    | Address    | Subject    | +------+---------+------------+------------+ | 101  | YashPal | Amritsar   | History    | | 105  | Gaurav  | Chandigarh | ...

Read More

Fraud Detection in Python

Pradeep Elance
Pradeep Elance
Updated on 04-Feb-2020 3K+ Views

Frauds are really in many transactions. We can apply machine learning algorithms to lies the past data and predict the possibility of a transaction being a fraud transaction. In our example we will take credit card transactions, analyse the data, create the features and labels and finally apply one of the ML algorithms to judge the nature of transaction as being fraud or not. Then we will find out the accuracy, precision as well as f-score of the model we are chosen.Preparing the DataWe in this step we read the source data, study the variables present in it and have ...

Read More

Fast XML parsing using Expat in Python

Pradeep Elance
Pradeep Elance
Updated on 04-Feb-2020 1K+ Views

Python allows XML data to be read and processed through its inbuilt module called expat. It is a non-validating XML parser. it creates an XML parser object and captures the attributes of its objects into various handler functions. In the below example we will see how the various handler functions can help us read the XML file as well as give the attribute values as the output data. This generated data can be used for the processing.Exampleimport xml.parsers.expat # Capture the first element def first_element(tag, attrs):    print ('first element:', tag, attrs) # Capture the last element def last_element(tag):   ...

Read More

Prefix to Infix Conversion in C++

sudhir sharma
sudhir sharma
Updated on 03-Feb-2020 2K+ Views

In this problem, we are given a prefix expression. Our task is to print the infix conversion of the given expression.Prefix expression is those expressions which have operators before the operands.Example: +AB.Infix expressions are those expressions which have operators between the operands.Example: A+BInfix expression are information for human understanding, but the computer does computations on prefix or postfix expressions (generally postfix).Let’s take an example to understand the problemInput: prefix : /+LM/NX Output: infix : (L+M) / (N/X)To solve this problem, we will be using the stack data structure. We will traverse the prefix expression in reverse order of the expression. ...

Read More

Prefixes with more a than b in C++

sudhir sharma
sudhir sharma
Updated on 03-Feb-2020 231 Views

In this problem, we are given string str containing only a and b and an integer N such that a string is created by appending str n times. Our task is to print the total number of substring in which the count of a’s is more than the count of b.Let’s take an example to understand the problemInput: aab 2 Output: 9 Explanation: created string is aabaab. Substrings with count(a) > count(b) : ‘a’ , ‘aa’, ‘aab’, ‘aaba’, ‘aabaa’, ‘aabaab’, ‘aba’, ‘baa’, ‘abaa’.To solve this problem, we will have to check if the string contains the required prefix subsets. Here, ...

Read More

Preorder from Inorder and Postorder traversals in C++

sudhir sharma
sudhir sharma
Updated on 03-Feb-2020 2K+ Views

In this problem, we are given the inorder and postorder traversal of a binary tree. Our task is to print the postorder traversal of the tree.Let’s take an example to understand the problemInput:inorder: 16 7 21 12 1 5 9 postorder: 16 21 7 1 9 5 12 Output: preorder: 12 7 16 21 5 1 9 Explanation: the binary tree is :To solve this problem, a simple solution could be creating a tree using the given traversals and then finding the preorder traversal of the tree. But this method will be more complex for the system.A more effective solution ...

Read More

Preorder predecessor of a Node in Binary Tree in C++

sudhir sharma
sudhir sharma
Updated on 03-Feb-2020 517 Views

In this problem, we are given a binary tree and a node value. Our task is to print the preorder predecessor of the node.Binary Tree is a special type of tree in which each root node can have maximum 2 child nodes.Preorder Traversal is a way to traverse nodes of the tree. In this we will first traverse root node then left child and then the right child.Preorder predecessor node is the node that comes before the node in the preorder traversal of the node.Let’s take an example to understand the problemInput: 1 Output: 9To solve this problem, a navie approach will ...

Read More
Showing 50011–50020 of 61,248 articles
Advertisements