MySQL Query a List of Values

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

6K+ Views

To query a list of values, you can use IN operator. The syntax is as follows −SELECT * FROM yourTableName WHERE yourColumnName IN(Value1, Value2, ...N) ORDER BY FIELD(yourColumnName, Value1, Value2, ...N);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ListOfValues    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(30),    -> Age int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert ... Read More

Know the Right Time to Start Your Own Business

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

204 Views

A year ago, I had shifted to a new city (and even a new state) of the country. Having been born and brought up in North India, I was not very familiar with this city in South India. Climate, people, culture everything was way different than where I used to live, but it was still a place where I had to stay.Restaurant ReviewingEverything can be adjusted, but the food is actually an offering to the soul and it is difficult to manage cooking along with a job. So, I resorted exploring food in the new city. Trying restaurants and then ... Read More

Geographical Plotting Using Python Plotly

Samual Sam
Updated on 30-Jul-2019 22:30:24

464 Views

Python provides various libraries to handle geographical and graph data. Python plotly is one of those libraries which are used to draw geographical graphs. Plotly is a free and open source library. Plotly helps to plot various kinds of graphs like Line charts, Horizontal bar charts, bar charts, dashboards, scatter plots, bubble charts, pie charts and many more.# Import important python geographical libraries. import plotly.plotly as py import plotly.graph_objs as go import pandas as pd # Must enable in order to use plotly off-line. from plotly.offline import download_plotlyjs, init_notebook_mode, iplot, plot # To establish connection init_notebook_mode() # type defined is ... Read More

Get the Type of a Variable in MySQL

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

1K+ Views

You cannot get the type of variable in MySQL. Cast the type of variable into another using CAST operator. The syntax is as follows −SET @yourVariableName:=’anyValue’Use the CAST operator to cast to another type. The syntax is as follows −SELECT CAST( @yourVariableName AS SIGNED);To understand the above syntax, let us cast to another type.Case 1: String to unsigned −mysql> set @StringToInt:='12345'; Query OK, 0 rows affected (0.00 sec)The query is as follows to another type −mysql> select CAST(@StringToInt as UNSIGNED);The following is the output −+--------------------------------+ | CAST(@StringToInt as UNSIGNED) | +--------------------------------+ | 12345               ... Read More

Performing MySQL-like Comparison on an INT Field

George John
Updated on 30-Jul-2019 22:30:24

792 Views

You need to use cast() method to perform comparison on an INT field. The syntax is as follows −SELECT yourColumnName1, yourColumnName2, ......N yourTableName WHERE CAST(yourColumnName as CHAR) LIKE ‘%yourIntegerValue%’;To understand the above syntax, let us create a table. The following is the query to create a table for performing a LIKE comparison on INT field −mysql> create table ComparisonOnIntField    -> (    -> StudentId int NOT NULL,    -> StudentName varchar(20),    -> StudentAge int    -> ); Query OK, 0 rows affected (1.00 sec)Insert some records in the table to perform a MySQL LIKE comparison on an INT ... Read More

Maximize Learning in Boring or Difficult Classes

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

153 Views

Students often run away from the subjects or classes they find boring or difficult. While the subject that they dislike differs from student to student. It becomes very difficult to be mentally present in a class where a boring subject is taught or when the way of teaching the teacher is either boring or complex. Here are some tips to make learning an enjoyable experience even if the subject lacks interest or the teacher does not know how to add interest.Know that It Is Still A Part Of SyllabusNo matter how boring the subject is, it is still going to ... Read More

Implementation of Dynamic Array in Python

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

14K+ Views

Dynamic ArrayIn python, a list, set and dictionary are mutable objects. While number, string, and tuple are immutable objects. Mutable objects mean that we add/delete items from the list, set or dictionary however, that is not true in case of immutable objects like tuple or strings.In python, a list is a dynamic array. Let's try to create a dynamic list −>>> #Create an empty list, named list1 >>> list1 = [] >>> type (list1) Add some items onto our empty list, list1 −>>> # Add items >>> list1 =[2, 4, 6] >>> list1 [2, 4, 6] >>> # Another way ... Read More

Extract Day, Month, Year from Timestamp in PHP MySQL

Samual Sam
Updated on 30-Jul-2019 22:30:24

943 Views

To extract the Day/Month/Year from a timestamp, you need to use the date_parse() function. The syntax as follows −print_r(date_parse(“anyTimeStampValue”));The PHP code is as follows −$yourTimeStampValue="2019-02-04 12:56:50"; print_r(date_parse($yourTimeStampValue));The snapshot of PHP code is as follows −The following is the output −Array ( [year] => 2019 [month] => 2 [day] => 4 [hour] => 12 [minute] => 56 [second] => 50 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) [is_localtime] => )The snapshot of the sample output −

Use COUNT to Get All Records in MySQL

George John
Updated on 30-Jul-2019 22:30:24

191 Views

Whenever you want all the values like not null for a column then use count(*). This is faster than using count() method.The syntax to use count(*) is as follows −select count(*) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a table is as follows −mysql> create table CountingDemo    -> (    -> BookId int    -> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into CountingDemo values(100); Query OK, 1 row affected (0.13 sec) ... Read More

Find Largest Number in an Array Using 8085 Microprocessor

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

25K+ Views

In this program we will see how to find the largest number from a block of bytes using 8085.Problem StatementWrite 8085 Assembly language program to find the largest number from a block of bytes.DiscussionIn this program the data are stored at location 8001H onwards. The 8000H is containing the size of the block. After executing this program, it will return the largest number and store it at location 9000H.Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory and storing it into register A. ... Read More

Advertisements