We can join two tables in SQL based on a common column between them or based on some specified condition. There are different types of JOIN available to join two SQL tables.Here, we will discuss about the inner join on two tables.JOIN and INNER JOIN both work the same way. The INNER JOIN matches each row in one table with every row in other table and allows to combine the rows from both the tables which either have somecommon column or which satisfy some condition which is specified.When applying join among two tables, we need to specify the condition based ... Read More
There might be a scenario where you might be deleting a table which actually does not exist in your database. It is possible that while executing the command to delete a table from the database, we may give wrong name of the table which doesnot exist in our database. The another possibility is that you are deleting a table which was already deleted by someone else who has access to the database. In this scenario you will get an error while executing the command since the table you wish to delete is not present.This error can be avoided by checking ... Read More
Most frequently, we do not require to select all the rows from the table. We may at times need to retrieve a particular number of records from a table, starting from some specific index. Suppose, we have a table of 10 records. We need to select 5 rows from the table starting from 3rd row.This is done using the LIMIT and OFFSET clause along with the SELECT statement. The LIMIT is used to specify the number of rows that you want to retrieve. The OFFSET is used to specify the starting position from where the rows are to be fetched. ... Read More
The data in the table may be outdated and we may require to change the data after some time. Suppose, we have a table of Students and one of the students have changed their address. We require to change the address of the student in the database to avoid any problems in future due to wrong data.The “UPDATE” statement in MySQL is used to update some value in the table.The SET clause is used to set the new value in the column. The WHERE clause is used to identify where in the table do we need to update the data ... Read More
It can be at times required to delete the whole table from the database. It is bad use of the storage to keep the unwanted data in the database. Suppose, we have a table named “Employees” in our database and due to some reasons , we do not require this table in our database anymore. Therefore, it is best to delete the particular table which is of no use to us.This is done using the “DROP TABLE” command. This table deletes the entire table from the database.SyntaxDROP TABLE table_nameHere, table_name specifies the name of the table you want to delete.Steps ... Read More
Inside SQL tables, columns usually contain duplicate values. We may sometimes need to get only the distinct or different values present in a column in our table since the duplicate values makes it difficult for us to analyze the results returned by the query.Example:Suppose, we have a table named Customers which conatins details about our customers, their names, age and country etc. We need to know to which different countries do our customers belong. We may have 10 customers from India, 15 from America and so on. If we simply select the country column, this will return us the whole ... Read More
We may at times need to delete certain rows from a table. Suppose, we have a table of details of students in the class. It is possible that one of the students left the class and hence, we do not require the details of that particular student. Hence, we need to delete that particular row or record from the table.The “DELETE FROM” statement in MySQL is used to delete a row or record from the table, The “WHERE” clause is used to specify the row to be deleted. If WHERE clause is not used, then all the records will be ... Read More
It is common to select certain data or rows from a table. The rows are returned in the order in which they appear in the table. We may sometimes require that the rows we select from the table must be returned to us in ascending or descending order with respect to some column.The “ORDER BY” statement is used to order the results with respect to some column. The following example will provide more clarity.Suppose, we have a table which consists of various fields including the “name” field. We want to select all the rows from the table but we want ... Read More
It is not frequently required to select all the data from the table. Instead , we need to select data or rows from the table based on some condition or criteria.Suppose, we have a table which includes names and marks of many students. Now, we need to get names of the students whose marks are above 90. This basically requires us to select data based on some criteria ,which is(marks>=90).Therefore, we are provided with “WHERE” statement in MySQL which allows us to select data from the table based on some specified criteria.SyntaxSELECT * FROM table_name WHERE conditionHere, table_name specifies the ... Read More
To plot scattered masked points and add a line to demark the masked regions, we can take the following steps.StepsSet the figure size and adjust the padding between and around the subplots.Create N, r0, x, y, area, c, r, area1and area2 data points using numpy.Plot x and y data points using scatter() method.To demark the maked regions, plot the curve using plot() method.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 100 r0 = 0.6 x = 0.9 * np.random.rand(N) y = 0.9 * ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP