Found 111 Articles for SQL

JavaScript - Find keys for the matched values as like query in SQL

AmitDiwan
Updated on 21-Nov-2020 09:52:33

315 Views

Suppose, we have an object like this −const obj = {"100":"Jaipur", "101":"Delhi", "102":"Raipur", "104":"Goa"};We are required to write a JavaScript function that takes in one such object as the first argument and a search query term as the second argument. Then our function should return all those key/value pairs whose value includes the search term provided to the function as the second argument.We will simply iterate through the object, building the resulting object (if it matches the condition) as we move through and lastly return that object.ExampleThe code for this will be −const obj = {    "100":"Jaipur",    "101":"Delhi", ... Read More

Difference between stored procedure and triggers in SQL

Himanshu shriv
Updated on 21-Jan-2020 09:58:29

16K+ Views

Stored procedures are a pieces of the code in written in PL/SQL to do some specific task. Stored procedures can be invoked explicitly by the user. It's like a java program , it can take some input as a parameter then can do some processing and can return values.On the other hand,  trigger is a stored procedure that runs automatically when various events happen (eg update, insert, delete). Triggers are more like an event handler they run at the specific event. Trigger can not take input and they can’t return values.Sr. No.KeyTriggersStored procedures1Basic trigger is a stored procedure that runs automatically when ... Read More

Difference between correlated and non-collreated subqueries in SQL

Himanshu shriv
Updated on 21-Jan-2020 09:56:58

8K+ Views

SQL query is used to fetch data from the database. In some of the scenario you may need some perquisite data to call subsequent SQL query to fetch data from a table so instead of writing two seperate query we can write SQL query within the query.Therefore subQuery is a way to combine or join them in single query. Subqurey can have two types −Correlated subquery - In correlated subquery, inner query is dependent on the outer query. Outer query needs to be executed before inner queryNon-Correlated subquery - In non-correlated query inner query does not dependent on the outer query. ... Read More

Difference between hierarchical and network database model in SQL

Himanshu shriv
Updated on 21-Jan-2020 09:47:19

9K+ Views

In Hierarchical data model, relationship between table and data is defined in parent child structure. In this structure data are arranged in the form of a tree structure. This model supports one-to-one and one-to-many relationships.On the other hand, network model arrange data in graph structure. In this model each parents can have multiple children and children can also have multiple parents. This model supports many to many relationships also.Sr. No.KeyHierarchical Data ModelNetwork Data Model1Basic Relationship between records is of the parent child typeRelationship between records is expressed in the form of pointers or links.2        Data Inconsistency It can have data ... Read More

Difference between Inner and Outer join in SQL

Himanshu shriv
Updated on 21-Jan-2020 09:41:05

2K+ Views

In Relational database tables are associated with each other and we used foreign key to maintain relationships between tables. We used join clause to retrieve data from associated tables. The join condition indicates how column in each table are matched against each other. There are two types of joins clause in SQL Inner join Outer joinOuter join is again divided into parts −LEFT OUTER JOIN - It will return all data of the left table and matched  records in both table RIGHT OUTER JOIN - it will return all the data of the right table and matched records in both tableSr. No.KeyInner joinOuter join1Basic It ... Read More

Difference between Delete and truncate in sql query

Kiran Kumar Panigrahi
Updated on 04-Aug-2022 07:36:51

16K+ Views

Both the TRUNCATE statement and the DELETE statement are included in the category of SQL queries for deleting the data stored in a table. They carry out deletion operations on records or rows of a table that are no longer needed. A condition is applied before each entry in the table that is being deleted when using the DELETE command. To put it another way, it is possible to delete one or more rows all at once. However, with the TRUNCATE command, each row is removed from the table simultaneously. When we delete something using the DELETE query, a log ... Read More

What is NoSQL and is it the next big trend in databases?

Sharon Christine
Updated on 16-Jan-2020 11:13:44

1K+ Views

What is NoSQL?As per the official Wiki definition: “A NoSQL (originally referring to “non SQL” or “non relational”) database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relation databases (RDBMS). It encompasses a wide variety of different database technologies that were developed in response to a rise in the volume of data stored about users, objects and products, the frequency in which this data is accessed, and performance and processing needs. Generally, NoSQL databases are structured in a key-value pair, graph database, document-oriented or column-oriented structure.Over decades ... Read More

Difference between Function and Procedure

Kiran Kumar Panigrahi
Updated on 02-Sep-2023 11:42:06

61K+ Views

SQL (Structured Query Language) is a computer language which is used to interact with an RDBMS (Relational Database Management System). It is basically a method of managing, organizing, and retrieving data from a relation database. In SQL, two important concepts are used namely, function and procedure. A function calculates the results of a program based on the inputs provided, whereas a procedure is used to perform some tasks in a specific order. There are many other differences between functions and procedures, which we will discuss in this article. What is Function? A function, in the context of computer programming languages, ... Read More

Print pyramid of tutorialspoint in PL/SQL

Sunidhi Bansal
Updated on 09-Aug-2019 06:19:06

711 Views

PL/SQL stands for “Procedural Language extension to SQL” . It is the mixture of SQL and Procedural features provided by programming language. It was developed by Oracle Corporation in the late 1980s as procedural extension language for SQL and the Oracle relational database.PL/SQL programs consists of blocks that can be nested and a block structure look likes this −DECLARE    -- it contains declaration statements BEGIN    -- It contains executable statements EXCEPTIONS    -- It contains exception handling statements END;ExampleIn PL/SQL single-line comments begin with double hyphen(--) and Multi-line comments begin with a slash-asterisk ( /* ) and end ... Read More

How to pass a date variable in sql query in a JSP?

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

907 Views

The tag is used as a nested action for the and the tag to supply a date and time value for a value placeholder. If a null value is provided, the value is set to SQL NULL for the placeholder.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueValue of the date parameter to set (java.util.Date)NoBodytypeDATE (date only), TIME (time only), or TIMESTAMP (date and time)NoTIMESTAMPExampleTo start with basic concept, let us create a simple table Students table in the TEST database and create a few records in that table as follows −Step 1Open a Command Prompt and change ... Read More

Previous 1 ... 6 7 8 9 10 ... 12 Next
Advertisements