Home
Search results “If null sql oracle”
26. IS NULL and IS NOT NULL in SQL (Hindi)
 
05:45
Please Subscribe Channel Like, Share and Comment Visit : www.geekyshows.com
Views: 16644 Geeky Shows
SQL tutorial 72: NVL SQL NULL function By Manish Sharma RebellionRider
 
03:50
Part 1: SQL Null Function NVL learn the concepts of NVL null function in this tutorial with examples and all the Interview concepts covered ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/nvl-sql-null-function Previous Tutorial ► LPAD & RPAD Functions https://youtu.be/nPtbuHPCN6E ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks ------------------------------------------------------------------------- Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=kb4rc1 -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! -------------------------------------------------------------------------- Amazon Wishlist: http://bit.ly/wishlist-amazon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 23485 Manish Sharma
NULL Value in Oracle Database | Oracle Tutorials for Beginners
 
03:18
NULL Value in Oracle Database | Oracle Tutorials for Beginners NULL Value in Oracle Database NULL Value in Oracle SQL NULL Value in SQL NULL Value in Oracle Database Oracle Tutorials for Beginners Oracle Tutorials for Beginners Oracle PL/SQL Tutorials for Beginners Oracle PL/SQL Tutorials for Beginners Oracle PL/SQL Tutorials for Beginners how to select null values in oracle oracle compare null values in where clause null=null in oracle how to handle null in case statement in oracle how to check null value in oracle stored procedure oracle nvl null value in oracle query how to check empty column value in oracle how to select null values in oracle oracle is null vs = null oracle nvl oracle is not null oracle decode oracle isnull oracle case when null select null from table in oracle oracle compare null values in where clause oracle select null how to check empty column value in oracle oracle sql not null or empty oracle is not null how to handle null in case statement in oracle oracle isnull oracle nvl
Views: 333 Oracle PL/SQL World
Differences between ISNULL and NULLIF - sql server interview questions
 
07:48
Hi friends, in this session I am gonna discuss the differences between ISNULL and NULLIF. Both ISNULL and NULLIF are built in system functions in sql server. Lot of people get confused between these 2 system functions. Lets discuss about each of these system functions separately so that you will get better idea. 1st lets discuss about ISNULL. ISNULL: ISNUL is a system function which replaces NULL with the specified replacement value. The functionalityof ISNULL is : 1. 1st it will Evaluate the expression which is in parameter 1. 2. it will compare the evaluated expression with null. if the paramter 1 = NULL ? 3. If parameter1 is equal to null i.e., if parameter 1 is null, then isnull function returns replacement value. if parameter1is not NULL, then ISNULL function returns parameter1 I hope we are clear on ISNULL. Lets move on to the next system function, that is NULLIF. NULLIF: NULLIF is a system function which returns a null value if the two specified expressions are equal. The functionalityof NULLIF is : 1. 1st it will Evaluate both the expression which are in parameter 1 and parameter 2. 2. next it will compare both the evaluated expressions with null. 3. If both the expressions are equal, the nullif functions returns NULL. 4. If both the expressions are not equal, the nullif functions returns 1st expression. Lets conclude the discussion with the similarities and differences between ISNULL and NULLIF Similarities: Both ISNULL and NULLIF are system functions. Syntax for Both the functions are similar Both ISNULL and NULLIF functions accepts 2 input parameters. Differences: isnull function compares 1st parameter with null.where as nullif function compares 1st parameter with 2nd parameter ISNULL function returns 2nd paramter if the 1st parameter isnull. nullif function returns null is 1st parameter = 2nd paramter. ISNULL function returns 1st paramter if the 1st parameter is not null. nullif function returns 1st paramter if 1st parameter is not equal to 2nd paramter. Thanks for watching this video. Bye , Have a good Day
Views: 7220 TheSSScreations
ORACLE SQL AND PL/SQL INTERVIEW QUESTION : SUBQUERY WITH NULL / NOT IN / NOT EXISTS OR OUTER JOIN
 
08:36
This video demonstrates the oracle sql interview question where one need to use either not in, not exists or an outer join to get the desired result. For example if one is asked to fetch records from department table where department_id is not present in employee table
Views: 1736 Kishan Mashru
Different ways to replace NULL in sql server - Part 15
 
11:42
In this video we will learn about the different ways to replace NULL values in sql server. 1. ISNULL() function 2. CASE statement 3. COALESCE() function Text version of the video http://csharp-video-tutorials.blogspot.com/2012/08/different-ways-to-replace-null-in-sql.html Slides http://csharp-video-tutorials.blogspot.com/2013/08/part-15-different-ways-to-replace-null.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 254746 kudvenkat
SQL Null or Empty   How to Check for Null or Empty Column in SQL Server   SQL Training Online
 
03:42
http://www.sqltrainingonline.com SQL Null or Empty - How to Check for Null or Empty Column in SQL Server - SQL Training Online You can download the sample table script at http://www.sqltrainingonline.com/how-to-filter-for-sql-null-or-empty-string/. In this video, I show you how to filter for a SQL null or empty string. It can be difficult to filter a null because you can't simply compare with an equal sign. You have to use a special IS NULL clause to make the filter work. I also show you how to combine both the SQL Null and Empty String together in a special trick with the isnull SQL Server function. I use SQL Server 2012 to demonstrate the technique. Let me know what you think by commenting or sharing on twitter, facebook, google+, etc. If you enjoy the video, please give it a like, comment, or subscribe to my channel. You can visit me at any of the following: SQL Training Online: http://www.sqltrainingonline.com Twitter: http://www.twitter.com/sql_by_joey Google+: https://plus.google.com/#100925239624117719658/posts LinkedIn: http://www.linkedin.com/in/joeyblue Facebook: http://www.facebook.com/sqltrainingonline
Views: 15132 Joey Blue
PL/SQL tutorial 9: IF THEN ELSE (IF-ELSE) Statement in PL/SQL by Manish Sharma
 
04:12
3rd tutorial in the series explaining IF-THEN-ELSE statement in Oracle PL/SQL with Example. Enjoy ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/if-then-else Previous Tutorial ► IF THEN Statement https://youtu.be/IWvuFD6eD30 ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks ------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 56350 Manish Sharma
IS NULL Operator in SQL Query with Example
 
02:24
SQL IS NULL Operator: A column value is NULL if it does not exist. The IS NULL operator is used to display all the rows for columns that do not have a value. For Example: If you want to find the emp names who do not get any commision, the query would be as given below: select * from emp where COMM IS NULL; In the opposite way, NOT NULL also works here: select * from emp where COMM IS NOT NULL; Thanks for watching..:)
Views: 3366 WingsOfTechnology
Oracle SQL Lecture 28: IS NULL and IS NOT NULL
 
03:19
Oracle SQL: IS NULL and IS NOT NULL https://www.youtube.com/channel/UCnBpiBIOtRgMsk4G7Ri1jbQ
Views: 707 Oracle SQL
IS NOT NULL, IS NULL, NVL FUNCTION in oracle sql
 
03:04
Oracle sql tutorial, How to select, retrieve rows with null values, not null values and NVL function in oracle SQL
SQL IS NULL AND IS NOT NULL
 
06:47
The ISNULL( ) function is available in both SQL Server and MySQL. However, their uses are different: SQL Server In SQL Server, the ISNULL( ) function is used to replace NULL value with another value.- For example, if we have the following table, Table Sales_Data Description In SQL Server (Transact-SQL), the ISNULL function lets you return an alternative value when an expression is NULL. Syntax The syntax for the ISNULL function in SQL Server (Transact-SQL) is: ISNULL( expression, alternative_value ) Parameters or Arguments expression The value to test whether it is NULL. alternative_value The value to return if the expression is a NULL value.
Views: 18 gracia heys
Oracle SQL Tutorial 19 - ON DELETE (SET NULL and CASCADE)
 
05:59
Welcome everyone! Something you need to consider when you are creating foreign keys is what happens if you delete the parent? As a reminder, the parent is the row that has the value you are referencing in the row that has a foreign key. Why is this something important to consider? It's important because foreign keys need to protect us from two primary things, unacceptable INSERT statements, and unacceptable DELETE statements. Let's see what happens when we try to insert incorrect data into the table with the foreign key: INSERT INTO projects VALUES (1, 'Update website homepage', 'CalebCurry') The response tells us plainly that there is no such user in the users table. So this works correctly. Deleting data on the other hand works a bit differently because the database does not know what you want to do with the child row when you delete the parent from the parent table. By default, we will get an error message that prevents the parent from being deleted, but there are some other options. How do we configure this? This is where the ON DELETE statement comes in. We add the keywords ON DELETE right after the foreign key and then we can give it the option of CASCADE or SET NULL. CASCADE means that if we delete the parent, we are also going to delete the child. In our situation what that means is that if somebody creates a project in our project table and then that persons account gets deleted, all of the projects he owns will also be deleted. CASCADE: CREATE TABLE projects( project_id NUMBER, Project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL, CONSTRAINT projects_pk PRIMARY KEY (project_id), CONSTRAINT projects_users_fk FOREIGN KEY (creator) REFERENCES users (username) ON DELETE CASCADE ) SET NULL will take the value in the child table and get rid of it. What you are left with is NULL. This means that we have an orphaned child. The first thought you might have is that it is a bad thing to have an orphaned child, but in databases that is not always so. In our application if we had it set to SET NULL, when a user account gets deleted the projects would remain in existence they would just lack a creator. This might be a good thing if you are concerned about the long term survival of a project, this might be the route you want to go. It ultimately depends on the application purpose. If you don't like CASCADE or SET NULL, you can leave the entire ON DELETE statement and just have Oracle throw an error when a parent is deleted. As for us, we are going to use ON DELETE CASCADE. We need to use this with extreme caution. If you are not careful, someday you will run a delete a row and that will cascade through you database deleting a bunch of stuff you didn't want to delete. Stuff happens, so make sure you back up your database every once in eternity. Now, in the last video we started with a database design that had three tables. We've only created two in this video. In the next video we are going to create the next one, which is a little special. Then we'll finish things up by adding some indexes. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me on Patreon! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 12400 Caleb Curry
PL/SQL tutorial 8: Simple IF -THEN conditional Control Statement By Manish Sharma RebellionRider
 
04:43
Learn the concept of simple IF THEN conditional control statement in Oracle PL/SQL by Manish Sharma RebellionRider.com ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/simple-if-then-in-oracle Previous Tutorial ► https://youtu.be/aDBHco_VgMo ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on Snapchat : RebellionRider https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check the "About" section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 57379 Manish Sharma
Oracle Database11g tutorials 13 || SQL substr function / SQL substring function
 
06:34
link of SQL substr blog : http://www.rebellionrider.com/SQL-substr-function.htm SQL substr function SQL Substr function will return a sub string of a specified length from the source string beginning at a given position. Tool used in this tutorial is command prompt. This tutorial series is part of SQL expert exam certification training. if you are preparing for SQL certification you can use my tutorials. This SQL Tutorial is a part of free training. Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=j7eYO7 Contacts E-Mail [email protected] Twitter https://twitter.com/rebellionrider Instagram http://instagram.com/rebellionrider Facebook. https://www.facebook.com/imthebhardwaj Linkedin. http://in.linkedin.com/in/mannbhardwaj/ Thanks for linking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ---------------------------------------------------------------------------- As the name suggests SQL Substr function will return substring from a given source string. Let's see the Syntax Substr (source_string, start_pos, Substr_length) As we can see SQL substr function takes 3 parameters. First one is Source string from which you want to extract the segment. Second parameter is Starting position for sub string from the Source string. And the third parameter is Substr_length which is the length for the substring. First two parameters are mandatory to specify while third one is optional. So we can say. SQL Substr function will return a sub string of a specified length from the source string beginning at a given position. First parameter source string can be of any data type CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB whereas both start_pos, Substr_length parameters must be number data type. The returning result of SQL Substr function is of same data type of source string. Let's see an example of SQL Substr function. SELECT substr('www.RebellionRider.com',5,14) FROM dual; Here in this query url of my website www.RebellionRider.com is our source string with the total length of 22 characters, Now, I want to extract the name of my website that is, RebellionRider. So if you count the total length of the name of the website, it is 14. That's why I have specified 14 as my third parameter of SQL Substr function which is substr_length. Also the name of the website RebellionRider is starting from 5th position therefore I have specified 5 at second parameter of SQL substr function which is strt_pos or starting position. Execute it. Here is our result RebellionRider When starting position is larger than the length of source string. In this case SQL Substr function will return NULL as a result. Let's do an example. SELECT substr('www.RebellionRider.com',23,14) FROM dual; As you can see here I have specified 23 at starting position and the total length of our source string is 22 characters Let's execute And the result is Null. Second scenario When the Substr_length is greater than source string In this case the segment return is the substring from starting position to the end of the string. For example SELECT substr('www.RebellionRider.com',5,23) FROM dual; Our starting position is at 5 means at the first R of RebellionRider and length of substring is set to 23 which is greater than the length of source string that is 22. Execute. As you can see we get a substring from first R of RebellionRider till the end of the source String. Third scenario When you supply numeric or arithmetic expression or a DATE instead of character as Source string to SQL Substr function In this scenario If you have supplied a numeric string instead of character as source string, the oracle engine casts them as a character when they occur as parameter to SQL Substr function. And if you have supplied Arithmetic expression or a DATE then The Oracle engine first solves or evaluates the Arithmetic expression or the DATE Then casts them as a character. Means if you have arithmetic expression in your source string then oracle will first solve it and then change or say cast the value of its result into character. Let's see some example. SELECT substr(50000-7,2,4) FROM dual; Oracle first evaluates the arithmetic expression that is 50000-7 equals to 49993. And then oracle engine casts this result 49993 into a character string. Means 49993 will be a 5 characters string. Starting position of substring is 2, that means from the first 9 of 49993 We specified the length of substring is 4 so we must get 9993 as our result. Let's check execute
Views: 77072 Manish Sharma
Tutorial 44 : NULL in Oracle || NVL() Explained
 
04:09
Hi Friends! Here we are learning about what is NULL in Oracle. How we can deal with NULL Values. How NVL() Function helps us with NULL Value. Hope the concept and example would be clear to you. For any help or issue, let me know in comment box. Thanks, Happy Coding.
Views: 64 YourSmartCode
SQL Server 26 - PRIMARY KEY, NOT NULL, UNIQUE
 
03:36
In the last video we created our first table, but I want to give SQL Server some extra information so the database knows more about each of the columns. The first thing is to establish the primary key. To do this all we do is add PRIMARY KEY after the column we want to be the primary key. Simple enough. When we add a constraint right after the column like this, it is often called a column attribute. CREATE TABLE Animals( ID INT PRIMARY KEY, Name VARCHAR(50), Species VARCHAR(50) ); Additionally, if you are using an ID column, it is best to have it labeled as the IDENTITY column. That way, SQL Server will automatically increment the number. CREATE TABLE Animals( ID INT PRIMARY KEY IDENTITY, Name VARCHAR(50), Species VARCHAR(50) ); The other attributes we've discussed in this series are NOT NULL and UNIQUE. We can make the name NOT NULL and the species NOT NULL. We don't have a good column for UNIQUE, so let's add one: CREATE TABLE Animals( ID INT PRIMARY KEY IDENTITY, Name VARCHAR(50) NOT NULL, Species VARCHAR(50) NOT NULL, ContactEmail VARCHAR(50) NOT NULL UNIUQE ); You can see that it is very easy to add multiple column attributes to a column. Just separate them by spaces. The order does not matter. Also, when you say primary key the column is automatically NOT NULL and UNIQUE. There are other attributes you can use including DEFAULT, FOREIGN KEY, and SPARSE. DEFAULT will give a value for a column if you do not put anything in yourself. Foreign keys are used to reference other columns. SPARSE is an attribute we haven't discussed. You can use SPARSE if most of the rows are going to have a NULL for a column and it saves storage space, but we will worry about that in another video. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 3480 Caleb Curry
Oracle interview question difference between null functions
 
07:23
Difference between NVL,NVL2, NULLIF and COALESCE NVL function will check whether the first input parameter is null, if first input parameter is null then the function returns the second parameter value as output. NVL2 function will check the first parameter, and return second parameter if the first parameter is not null, otherwise returns third parameter. NULLIF will compare the input parameters ( first and second parameter ), and returns NULL of both are same, otherwise returns the first parameter value. COALESCE, returns the first not null expression in the given input parameters. -------------------------------------------------------------------------------------------------------- List of all the SQL and PLSQL interview questions https://easy-learning-tech.blogspot.com/p/oracle-sql-plsql-interview-questions.html
Views: 65 Siva Academy
SQL tutorial 73: NVL2 SQL null function By Manish Sharma RebellionRider
 
03:01
Part 2: SQL Null Function NVL2 learn the concepts of NVL null function in this tutorial with examples and all the Interview concepts covered ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/nvl2-null-function Previous Tutorial ► NVL function https://youtu.be/aRoTR5Jn6K0 ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks ------------------------------------------------------------------------- Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=kb4rc1 -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! -------------------------------------------------------------------------- Amazon Wishlist: http://bit.ly/wishlist-amazon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 20369 Manish Sharma
17/125 Oracle PLSQL: Handling Nulls in IF Statement
 
09:23
Learn Oracle PLSQL EXAM 1Z0-144
Views: 876 khaled alkhudari
SQL tutorial 49: CASE - Simple Case Expression in Oracle Database (1/2)
 
06:34
Case expression let you perform IF-THEN-ELSE in oracle database. There are two type of case in oracle simple case expression and searched case expression. This SQL Tutorial 49 is about Simple Case Expression. ● What Is Case Expression ● Syntax of Simple Case Expression ● Query 1. Column name of a table as Search expression in CASE ● Query 2. String as Search expression in CASE Celebrating 1000 subscribers. Thanks a lot guys for all your love and support. ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog: http://bit.ly/simple-case-expression ------------------------------------------------------------------------- Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=kb4rc1 -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the first one to see my videos! -------------------------------------------------------------------------- Amazon Wishlist: http://bit.ly/wishlist-amazon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at [email protected] Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 34906 Manish Sharma
OracleSQL#27 How  NULL value treated in Oracle Database|IS NULL Operator
 
04:27
explaining about the different ways to treats NULL values in Oracle SQL server or How we can replace null values with some other values using IS NULL Operator or Different ways to replace NULL in SQL server IS NULL and IS NOT NULL in SQL or IS NULL Operator in SQL Query with Example orHow to Check for Null or Empty Column in SQL or Problems with Null Value in SQL or is NOT NULL, IS NULL, NVL FUNCTION in Oracle SQL or How can I find unknown values? orHow to convert null to 0 in SQL server orNull value in Oracle or replacing NULL in SQL In this series we cover the following topics: SQL basics, create table oracle, SQL functions, SQL queries, SQL server, SQL developer installation, Oracle database installation, SQL Statement, OCA, Data Types, Types of data types, SQL Logical Operator, SQL Function,Join- Inner Join, Outer join, right outer join, left outer join, full outer join, self-join, cross join, View, SubQuery, Set Operator. follow me on: Facebook Page: https://www.facebook.com/LrnWthr-319371861902642/?ref=bookmarks Contacts Email: [email protected] Instagram: https://www.instagram.com/lrnwthr/ Twitter: https://twitter.com/LrnWthR
Views: 50 EqualConnect Coach
Oracle SQL Tutorial -  Handling Null values
 
13:01
In this video, we will see how to handle null values. Retrieving rows where specific column value IS NULL or NOT NULL. Also, we will see functions to handle NULL values. NVL ,NVL2 and NULL IF functions.
Views: 6 Ganesh Anbarasu
MySQL - How to Change Null Values to 0 in SQL
 
00:51
Get Source Code/Read : http://intactabode.com/ For Developing support email your Details at : [email protected] Install Free Trail GST Ready Accounting Package Send your Contact information Name, Email, Contact Number to email : [email protected] watch demo in English : https://www.youtube.com/watch?v=a4sFNtZuYzs&ab_channel=IntactAbode watch demo in Hindi : https://www.youtube.com/watch?v=I3eCieDpG3o&ab_channel=IntactAbode Website : http://relybill.com/ Watch More Frequently Used Sql Queries in all Databases Complete Playlist: https://www.youtube.com/playlist?list=PLErD1cRL87W992bgZ_TX7gxl5UKuP9yF9 In this videos i show how to update your null values to zero or o in sql, if you wanted change all the null values in your sql to numerical zero 0, this syntax will sure help you to solve the problem. in some cases i you wanted to display your null values to 0 in sql, mysql, oracle or any other jdbc database this querry will sure help you solve the problem in sql syntax. For Source Code Visit : http://corneey.com/wJ6X2K Subscribe to YouTube channel http://corneey.com/wJ6VoC Like us on Facebook http://corneey.com/wJ6C2l Follow us on Twitter http://corneey.com/wJ6C7x Follow me on Google+ http://corneey.com/wJ6Vhc linkedin http://corneey.com/wJ6V5g
Views: 2314 Intact Abode
PL/SQL:NVL/NVL2/Coalesce function
 
05:26
In this tutorial, you'll learn the difference between NVL,NVL2 &Coalesce functions PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database (since version 7), TimesTen in-memory database (since version 11.2.1), and IBM DB2 (since version 9.7).[1] Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database. PL/SQL includes procedural language elements such as conditions and loops. It allows declaration of constants and variables, procedures and functions, types and variables of those types, and triggers. It can handle exceptions (runtime errors). Arrays are supported involving the use of PL/SQL collections. Implementations from version 8 of Oracle Database onwards have included features associated with object-orientation. One can create PL/SQL units such as procedures, functions, packages, types, and triggers, which are stored in the database for reuse by applications that use any of the Oracle Database programmatic interfaces. PL/SQL works analogously to the embedded procedural languages associated with other relational databases. For example, Sybase ASE and Microsoft SQL Server have Transact-SQL, PostgreSQL has PL/pgSQL (which emulates PL/SQL to an extent), and IBM DB2 includes SQL Procedural Language,[2] which conforms to the ISO SQL’s SQL/PSM standard. The designers of PL/SQL modeled its syntax on that of Ada. Both Ada and PL/SQL have Pascal as a common ancestor, and so PL/SQL also resembles Pascal in several aspects. However, the structure of a PL/SQL package does not resemble the basic Object Pascal program structure as implemented by a Borland Delphi or Free Pascal unit. Programmers can define public and private global data-types, constants and static variables in a PL/SQL package.[3] PL/SQL also allows for the definition of classes and instantiating these as objects in PL/SQL code. This resembles usage in object-oriented programming languages like Object Pascal, C++ and Java. PL/SQL refers to a class as an "Abstract Data Type" (ADT) or "User Defined Type" (UDT), and defines it as an Oracle SQL data-type as opposed to a PL/SQL user-defined type, allowing its use in both the Oracle SQL Engine and the Oracle PL/SQL engine. The constructor and methods of an Abstract Data Type are written in PL/SQL. The resulting Abstract Data Type can operate as an object class in PL/SQL. Such objects can also persist as column values in Oracle database tables. PL/SQL is fundamentally distinct from Transact-SQL, despite superficial similarities. Porting code from one to the other usually involves non-trivial work, not only due to the differences in the feature sets of the two languages,[4] but also due to the very significant differences in the way Oracle and SQL Server deal with concurrency and locking. There are software tools available that claim to facilitate porting including Oracle Translation Scratch Editor,[5] CEITON MSSQL/Oracle Compiler [6] and SwisSQL.[7] The StepSqlite product is a PL/SQL compiler for the popular small database SQLite. PL/SQL Program Unit A PL/SQL program unit is one of the following: PL/SQL anonymous block, procedure, function, package specification, package body, trigger, type specification, type body, library. Program units are the PL/SQL source code that is compiled, developed and ultimately executed on the database. The basic unit of a PL/SQL source program is the block, which groups together related declarations and statements. A PL/SQL block is defined by the keywords DECLARE, BEGIN, EXCEPTION, and END. These keywords divide the block into a declarative part, an executable part, and an exception-handling part. The declaration section is optional and may be used to define and initialize constants and variables. If a variable is not initialized then it defaults to NULL value. The optional exception-handling part is used to handle run time errors. Only the executable part is required. A block can have a label. Package Packages are groups of conceptually linked functions, procedures, variables, PL/SQL table and record TYPE statements, constants, cursors etc. The use of packages promotes re-use of code. Packages are composed of the package specification and an optional package body. The specification is the interface to the application; it declares the types, variables, constants, exceptions, cursors, and subprograms available. The body fully defines cursors and subprograms, and so implements the specification. Two advantages of packages are: Modular approach, encapsulation/hiding of business logic, security, performance improvement, re-usability. They support object-oriented programming features like function overloading and encapsulation. Using package variables one can declare session level (scoped) variables, since variables declared in the package specification have a session scope.
Views: 3561 radhikaravikumar
SQL tutorial 74: SQL COALESCE Function In oracle Database Manish Sharma
 
04:44
Third tutorial in SQL Null Series. Coalesce Null function with example in oracle Database. ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/sql-coalesce Previous Tutorial ► NVL https://youtu.be/aRoTR5Jn6K0 ► NVL2 https://youtu.be/SCwc0HcS1-U ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! -------------------------------------------------------------------------- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 25350 Manish Sharma
SQL with Oracle 10g XE - Using INSERT to Add Data to a Table
 
06:20
In this video I use the INSERT command to add an entire record into a table. When using the command you must also use the keyword VALUES. If you want to enter a null value (one that has no value) for a field you can use the keyword NULL. Be sure to put single quotes around data types that are not numbers. Values need to be entered in the order the fields appear in the table. The commands I used are: INSERT INTO BOOKS VALUES (1,'140231862','9780140231861','The Winter King: A Novel of Arthur','Fiction','14.99','P',1996,1,2) INSERT INTO BOOKS VALUES ('2','140232478','9780140232479','Enemy of God: A Novel of Arthor','Fiction',14.99,'P','1997',1,2); INSERT INTO BOOKS VALUES ('3','140232877','9780140232875','Excalibur: A Novel of Arthor','Fiction',14.99,'P','1998',1,2); INSERT INTO BOOKS VALUES ('4','6513840','9780006513841','Harlequin: Grail Quest','Fiction',19.99,'P','2001',1,1); INSERT INTO BOOKS VALUES ('5','6513859','9780006513858','Vagabond: Grail Quest','Fiction',19.99,'P','2003',1,1); INSERT INTO BOOKS VALUES ('6','7149891','9780007149896','Heretic: Grail Quest','Fiction',19.99,'P','2004',1,1); INSERT INTO BOOKS VALUES ('7','553103547','9780553103540','A Game of Thrones','Fiction',13.99,'H','1996',2,4); INSERT INTO BOOKS VALUES ('8','553801473','9780553801477','A Dance with Dragons','Fiction',13.99,'H','2010',2,5); INSERT INTO BOOKS VALUES ('9','055357342X','9780553573428','A Storm of Swords','Fiction',4.99,'P','2003',2,4); INSERT INTO BOOKS VALUES ('10','1596590424','9781596590427','50 Success Classics','Audio',17.99,NULL,NULL,3,3) INSERT INTO AUTHOR VALUES (1,'Cornwell','Bernard'); INSERT INTO AUTHOR VALUES (2,'Martin','George'); INSERT INTO AUTHOR VALUES (3,'Butler','Tom'); INSERT INTO PUBLISHER VALUES (1,'HarperCollins Publishers Canada, Limited'); INSERT INTO PUBLISHER VALUES (2,'Penguin Books Canada, Limited'); INSERT INTO PUBLISHER VALUES (3,'Gildan Media Corp'); INSERT INTO PUBLISHER VALUES (4,'Bantam Dell Pub Group'); INSERT INTO PUBLISHER VALUES (5,'Spectra'); This video is part of a series of videos with the purpose of learning the SQL language. For more information visit Lecture Snippets at http://lecturesnippets.com.
Views: 39678 Lecture Snippets
SQL TUTORIALS : NULL VALUES
 
03:06
WHAT IS NULL IN SQL PLUS? DEFINING NULL VALUE.
Views: 2619 learnoracle9i
Null: Databases for Developers #10
 
07:42
The null value represents missing or unknown information. But using it brings complications to your SQL. In this video Chris discusses how to work with null to ensure you get the correct results. Further reading: Oracle Database SQL Reference on Nulls: http://docs.oracle.com/database/122/SQLRF/Nulls.htm#SQLRF30037 Null related functions: http://docs.oracle.com/database/122/SQLRF/Single-Row-Functions.htm#SQLRF51187 Is null condition: http://docs.oracle.com/database/122/SQLRF/Null-Conditions.htm#SQLRF52152 Need help with SQL? Ask us over on AskTOM: https://asktom.oracle.com Twitter: https://twitter.com/ChrisRSaxon Daily SQL Twitter tips: https://twitter.com/SQLDaily All Things SQL blog: https://blogs.oracle.com/sql/ ============================ The Magic of SQL with Chris Saxon Copyright © 2015 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.
Views: 2260 The Magic of SQL
COALESCE Function in SQL ORACLE Query With Example
 
03:53
ORACLE/PLSQL: COALESCE FUNCTION The Oracle/PLSQL COALESCE function returns the first non-null expression in the list. If all expressions evaluate to null, then the COALESCE function will return null. The syntax for the Oracle/PLSQL COALESCE function is: coalesce( expr1, expr2, ... expr_n ) PARAMETERS: expr1 to expr_n are the expressions to test for non-null values. EXAMPLE: The COALESCE function can be used in Oracle/PLSQL. You could use the coalesce function in a SQL statement as follows: SELECT COALESCE( address1, address2, address3 ) result FROM suppliers; The above COALESCE function is equivalent to the following IF-THEN-ELSE statement: IF address1 is not null THEN result := address1; ELSIF address2 is not null THEN result := address2; ELSIF address3 is not null THEN result := address3; ELSE result := null; END IF; The COALESCE function will compare each value, one by one. Lets apply the same to emp table. We have some NULL values in comm and mgr columns. but not in any other columns. So lets take a example for this 2 columns. COALESCE(comm,mgr,sal) Here if comm is null, function returns mgr value. If mgr is null it returns sal value! Query used in video: SELECT ename,comm,mgr,sal,COALESCE(comm,mgr,sal) result FROM emp;
Views: 6132 WingsOfTechnology
Concept of a Null Value in SQL - Part 1 - SQL LESSON 23
 
05:01
Concept of a Null Value in SQL - Part 1 - SQL LESSON 23
Views: 13323 HandsonERP
Oracle SQL Tutorial 13 - How to Add Column Constraints (Attributes)
 
05:55
So far, we have this table declaration: CREATE TABLE users( user_id NUMBER, username VARCHAR(50 CHAR) first_name VARCHAR2(50 CHAR), last_name VARCHAR2(50 CHAR) ) We can run this command see that it works. As we are learning though, we are going to want to be able to recreate our table with different settings and such, but if you try to run this command, it will complain that the table already exists. So we first need to delete this table before we start editing settings. When we get more experienced, we will learn about ways to edit the structure of a table that already exists. To fix this, we can get rid of the table using the DROP TABLE command: DROP TABLE users You can run this every time if you need to practice by adding a semicolon after it. This is how you can tell Oracle that you are putting in another command after it. This is known as a delimiter. When you run the script, it is going to run both commands. Now we can go through and reconsider our table structure. This is fine for starting out because we don't have any important data in our database, but once your database is in production you are not going to want to just drop tables. In the last video we discussed different constraints that you can apply to columns in a database table, but how do you actually apply these when you are creating a table? The first way you define constraints is to put them right after the column in your CREATE TABLE statement. CREATE TABLE users( username VARCHAR2(50 CHAR) NOT NULL ) When we define constraints this way, we usually say we are adding column attributes. If you have two constraints you want to add, you just put one after the other with spaces in between. There is no particular order that is required. CREATE TABLE users( username VARCHAR2(50 CHAR) NOT NULL UNIQUE ) In this situation we have already given the column the NOT NULL and UNIQUE attributes, so we should consider making this a primary key: CREATE TABLE users( username VARCHAR2(50 CHAR) PRIMARY KEY ) As you can see, adding column attributes is super easy. We can add a default like this: CREATE TABLE users( username VARCHAR2(50 CHAR) PRIMARY KEY, account_balance NUMBER DEFAULT 0 ) Note that now we need the comma after the first row. There are a few constraints we did not talk go through an example, specifically foreign keys and check constraints. We will be adding these constraints to our database in future videos. In the mean time, I have a thought for you… Many people prefer to name their column constraints. That way, we can refer to certain constraints by name. For example, we might have a primary key constraint that could be named users_pk. The way we are creating these constraints does not allow for this feature, so in the next video we are going to be discussing different ways to create constraints. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me on Patreon! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 16559 Caleb Curry
Oracle NVL Function Explained with Examples
 
09:25
https://www.databasestar.com/oracle-nvl-nvl2-logical-functions/ The Oracle NVL function allows you to check a value and return a different value if that value is NULL. It’s great for using another value if the first one is NULL or an optional value, for example people’s phone numbers. It’s also good alongside aggregate functions and grouping so you can see what the difference is between a subtotal row and an actual NULL value. The syntax of the Oracle NVL function is: NVL( check_value, replace_value ) The parameters are: - check_value (mandatory): This is the value that is displayed to the user. It is also the value that is checked for NULL. - replace_value (mandatory): This is the value that appears if the check_value is NULL. The function can use many different data types as parameters: string, date, or numeric. However, both parameters need to be the same type. For more information about the Oracle NVL function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-nvl-nvl2-logical-functions/
Views: 89 Database Star
How to filter Rows with Null Values in Select Statement - SQL Server / TSQL Tutorial Part 110
 
09:08
SQL Server / T-SQL Tutorial Scenario: How to filter Rows with Null Values in Select Statement in SQL Server Let's say that you are working as SQL Server developer. You need to write two queries 1) Return all the records from dbo.Customer table where Address column has Null values 2) Return only the records from dbo.Customer table where Address column has the values other than Null. Link to scripts used in SQL Server / TSQL Tutorial Video http://www.techbrothersit.com/2016/06/how-to-filter-rows-with-null-values-in.html Check out our website for Different SQL Server, MSBI tutorials and interview questions such as SQL Server Reporting Services(SSRS) Tutorial SQL Server Integration Services(SSIS) Tutorial SQL Server DBA Tutorial SQL Server / TSQL Tutorial ( Beginner to Advance) http://www.techbrothersit.com/
Views: 3091 TechBrothersIT
SQL6 - NULL values; the COUNT function
 
04:42
What NULL values are, using "IS NULL" and "IS NOT NULL" in where statements. The count function, including examples of using COUNT with a WHERE clause.
Views: 627 Charles Boisvert
SQL CASE
 
05:44
Jamie King of Neumont University demonstrating CASE.
Views: 27173 Jamie King
Null value in oracle
 
09:08
this video describes null concept in oracle. join the group and share your knowledge and ask your doubts. https://www.facebook.com/groups/940425699338535/
Oracle COALESCE Function
 
04:00
https://www.databasestar.com/oracle-coalesce/ The COALESCE function in Oracle allows you to input one or many values and return a value that is not NULL. You provide it with a series of values, and it returns the first of thsoe values which are not NULL. The syntax of the Oracle COALESCE function is: COALESCE(expr1, expr2 [, expr_n]) These parameters are: Expr1: the first expression to check for a NULL value. If it’s NULL, the function checks the next parameter. If not, then this value is returned. Expr2: the second expression to check for a NULL value, if the first expression is NULL. If this is NULL, then the next expression is checked, otherwise this value is returned. Expr_n: More expressions can be added and checked in case both expr1 and expr2 are null. Only the first two expressions are needed. The first non-NULL expression is returned. But, if all expressions are NULL, then NULL is returned. One way I’ve recently used this was to find out what phone number to display. A query looked at the mobile number and returned that, but if it was NULL it looked at the home phone and returned that, but if that was NULL it looked to the business phone number. That query looked like this: COALESCE(mobile_phone, home_phone, business_phone) For more information about the Oracle COALESCE function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-coalesce/
Views: 435 Database Star
Oracle SQL Tutorial 12 - Intro to Constraints
 
06:13
As I believe I've mentioned in an earlier video, a constraint is basically a rule we can put in our database that prevents someone from putting the wrong data in. It protects our relationships and data integrity. Because the goal of these constraints are to protect our data integrity, you may hear them called integrity constraints. There are many integrity constraints we are going to talk about: NOT NULL UNIQUE PRIMARY KEY FOREIGN KRY CHECK There is also the DEFAULT attribute. These are all keywords we can add to our columns that will change the way the database works with our data and also prevents incorrect data. NOT NULL is a constraint you can put on a column that prevents nulls. A null is the absence of a value. When we say null, we are saying that every single row has to have a value for this column. UNIQUE is a constraint that makes every row have a unique value for this column. Now note, this does not require values to be put it, and it will allow multiple rows to be null. Next, we are going to talk about primary keys. What qualifies a column as a candidate key? First, not a single row should have a null for that column. Second, every row must be unique. The primary key constraint is essentially a combination of the NOT NULL constraint and the UNIQUE constraint. The foreign key constraint sets the requirement that any value in this column for any row must match a row in another column. Check constraints allow us to be more strict with what data is allowed in our database. NOT NULL and UNIQUE give some level of restriction, but what if we want something more specific? For example, what if we only want values between 0 and 100? That is where check constraints come in. When using check constraints, you give a boolean expression. A boolean expression is something that can be evaluated to true or false. It will only insert the row if the value you try to put into the row makes the expression evaluate to true. So if you put in a value too great or small, the expression will be false and the data is not allowed to be entered. The default constraint is a value you can give a column, and if for any reason when the row is created in the table a value is not provided, the default value will be given. So for example, we could have a bank account table where the balance defaults to 0. How do you actually implement these constraints when you are creating a table? In the next video we are going to be adding these to our users table. Please be sure to subscribe! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me on Patreon: http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 16747 Caleb Curry
Oracle NVL2 Function
 
03:05
https://www.databasestar.com/oracle-nvl-nvl2-logical-functions/ The Oracle NVL2 function is an extension of the NVL function and can be used to handle NULL values. It allows you to specify a value to check for NULL, a separate value to return if the value is NULL, and another value to return if the first value is not NULL. It’s very similar to NVL but allows for more flexibility. The syntax for NVL2 is: NVL2( value_to_check, value_if_not_null, value_if_null ) What are these parameters: Value_to_check is the value the function checks to see if it is NULL. Value_if_not_null is the value to return if the first value, value_to_check, is not NULL. Value_if_null is the value to return if the first value, value_to_check, is NULL. These parameters can have almost any data type (the second and third parameter can’t be a LONG data type). Oracle will determine the data type from the supplied parameters. There are quite a few of these conditional checking functions in Oracle, so the one to use would depend on your needs. But it’s good to know this function exists. For more information about the Oracle NVL2 function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-nvl-nvl2-logical-functions/
Views: 222 Database Star
7. Compile-time warnings help avoid "WHEN OTHERS THEN NULL".
 
03:23
One of Tom Kyte's favorite pet peeves, the following exception sections "swallow up" errors. EXCEPTION WHEN OTHERS THEN NULL; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE (SQLERRM); In fact, any exception handler that does not re-raise the same exception or another, runs the risk of hiding errors from the calling subprogram, your users, and yourself as you debug your code. Generally, you should log the error, then re-raise it. There are certainly some cases in which this advice does not hold (for example: a function that fetches a single row for a primary key. If there is no row for the key, it's not an application error, so just return NULL). In those cases, include a comment so that the person maintaining your code in the distant future knows that you weren't simply ignoring the Wisdom of the Kyte. Example: EXCEPTION WHEN OTHERS THEN /* No company or this ID, let calling subprogram decide what to do */ RETURN NULL; One way to avoid this problem is to turn on compile-time warnings. Then when your program unit is compiled, you will be warned if the compiler has identified an exception handler that does not contain a RAISE statement or a call to RAISE_APPLICATION_ERROR. Related blog post: http://stevenfeuersteinonplsql.blogspot.com/2016/03/nine-good-to-knows-about-plsql-error.html ======================================== Practically Perfect PL/SQL with Steven Feuerstein Copyright © 2015 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.
SQL, null values, Lesson 22
 
03:54
how to deal with null values in SQL
Views: 3858 hammadshams
SQL Totals and Sub totals using ROLLUP (with sample scenario)
 
03:59
Totals and Subtotals using ROLLUP in : -- ORACLE SQL select case when c.customer_name is null then 'TOTAL' else c.customer_name end CUST_NAME ,case when lt.name is null then 'SUB-TOTAL' else lt.name end Loan_Type ,sum(lr.loan_amount) from loan_request lr join customers c on c.customer_id=lr.customer_id join loan_types lt on lt.loan_type_id = lr.loan_type_id group by rollup(c.customer_name,lt.name) --MYSQL select case when c.customer_name is null then 'TOTAL' else c.customer_name end CUST_NAME ,case when lt.name is null then 'SUB-TOTAL' else lt.name end Loan_Type ,sum(lr.loan_amount) from loan_request lr join customers c on c.customer_id=lr.customer_id join loan_types lt on lt.loan_type_id = lr.loan_type_id group by c.customer_name,lt.name with rollup
Views: 298 nechali
Oracle SQL Tutorial 16 - Parent Child Relationships
 
06:09
So far in this series we have discussed database design, creating tables, and constraints. We've brought up the concept of foreign keys, but we have not explained how to create them. That is the goal of this video and the upcoming videos. We want to study those foreign keys! Let's make them not so foreign. Let's learn the proper way to define a foreign key. As a reminder, a foreign key is a column that references a column of another table. The column it references must either be a primary key, or have the UNIQUE constraint. This means that every value inside of the column that is labeled as a foreign key, there must be that value in some row of the referenced column. As an example, imagine that we have the users table, and we have a table service_requests. We could have a column in the service_request that references a column in the users table. Usually this would be the primary key that is referenced, but there is nothing stopping you from referencing a unique column. Just for fun, let's go through an example using the username column. If we have a service_requests table, every single row within the table is going to be what some would consider an instance of a service_request. This means that the table columns are like the blueprint for what a service request looks like and then each row is an individual service request. If we have one of the columns labeled as a foreign key to the username of the users table, what does that mean practically? It means that for a single row, the value for that column must be a value that exists in the users table. We could have a service_request submitted by a user with the username of Yoloswagman. This means that there must be a row inside of the users table that has the value Yoloswagman for the username column. This brings up the concept of parent and child relationships. Yoloswagman in this situation is the parent, and his service request is the child. When we draw it out, it makes sense why a primary key must be UNIQUE. If we had two Yoloswagmans, the child would not know which column is the parent. The same applies if we were using IDs and we had So remember, always reference a primary key or a column with the UNIQUE constraint. Now, I have a question for you. Do foreign keys automatically have the UNIQUE constraint, just like primary keys? The answer is no. A parent row can have many child rows. It makes sense because the user could submit multiple service requests. Can we force the column to be unique? Absolutely. If that was the case, the user could only make one service request. Another question. Do foreign keys automatically have the NOT NULL constraint, just like primary keys? The answer is no. Essentially what this means is that a child could be created with no parent. Can we force the column to be NOT NULL? Absolutely. It is ok in some situations to allow the row to be null, but in this situation it makes no sense. It would be wise for us to add that constraint ourselves. So now that you understand some more differences between primary and foreign keys and parent child relationships, take all of these questions into consideration when you are creating foreign keys. In the next video, we are going to start a small project that is going to require multiple tables. We'll take a video to design our structure and then we'll get to creating those foreign keys in Oracle SQL Developer. Stick around and if you like these videos please be a serious supporter and subscribe to my channel. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELP ME! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 10238 Caleb Curry
SQL: WITH Clause
 
06:11
In this tutorial, you'll learn will learn how to use with clause PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database (since version 7), TimesTen in-memory database (since version 11.2.1), and IBM DB2 (since version 9.7).[1] Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database. PL/SQL includes procedural language elements such as conditions and loops. It allows declaration of constants and variables, procedures and functions, types and variables of those types, and triggers. It can handle exceptions (runtime errors). Arrays are supported involving the use of PL/SQL collections. Implementations from version 8 of Oracle Database onwards have included features associated with object-orientation. One can create PL/SQL units such as procedures, functions, packages, types, and triggers, which are stored in the database for reuse by applications that use any of the Oracle Database programmatic interfaces. PL/SQL works analogously to the embedded procedural languages associated with other relational databases. For example, Sybase ASE and Microsoft SQL Server have Transact-SQL, PostgreSQL has PL/pgSQL (which emulates PL/SQL to an extent), and IBM DB2 includes SQL Procedural Language,[2] which conforms to the ISO SQL’s SQL/PSM standard. The designers of PL/SQL modeled its syntax on that of Ada. Both Ada and PL/SQL have Pascal as a common ancestor, and so PL/SQL also resembles Pascal in several aspects. However, the structure of a PL/SQL package does not resemble the basic Object Pascal program structure as implemented by a Borland Delphi or Free Pascal unit. Programmers can define public and private global data-types, constants and static variables in a PL/SQL package.[3] PL/SQL also allows for the definition of classes and instantiating these as objects in PL/SQL code. This resembles usage in object-oriented programming languages like Object Pascal, C++ and Java. PL/SQL refers to a class as an "Abstract Data Type" (ADT) or "User Defined Type" (UDT), and defines it as an Oracle SQL data-type as opposed to a PL/SQL user-defined type, allowing its use in both the Oracle SQL Engine and the Oracle PL/SQL engine. The constructor and methods of an Abstract Data Type are written in PL/SQL. The resulting Abstract Data Type can operate as an object class in PL/SQL. Such objects can also persist as column values in Oracle database tables. PL/SQL is fundamentally distinct from Transact-SQL, despite superficial similarities. Porting code from one to the other usually involves non-trivial work, not only due to the differences in the feature sets of the two languages,[4] but also due to the very significant differences in the way Oracle and SQL Server deal with concurrency and locking. There are software tools available that claim to facilitate porting including Oracle Translation Scratch Editor,[5] CEITON MSSQL/Oracle Compiler [6] and SwisSQL.[7] The StepSqlite product is a PL/SQL compiler for the popular small database SQLite. PL/SQL Program Unit A PL/SQL program unit is one of the following: PL/SQL anonymous block, procedure, function, package specification, package body, trigger, type specification, type body, library. Program units are the PL/SQL source code that is compiled, developed and ultimately executed on the database. The basic unit of a PL/SQL source program is the block, which groups together related declarations and statements. A PL/SQL block is defined by the keywords DECLARE, BEGIN, EXCEPTION, and END. These keywords divide the block into a declarative part, an executable part, and an exception-handling part. The declaration section is optional and may be used to define and initialize constants and variables. If a variable is not initialized then it defaults to NULL value. The optional exception-handling part is used to handle run time errors. Only the executable part is required. A block can have a label. Package Packages are groups of conceptually linked functions, procedures, variables, PL/SQL table and record TYPE statements, constants, cursors etc. The use of packages promotes re-use of code. Packages are composed of the package specification and an optional package body. The specification is the interface to the application; it declares the types, variables, constants, exceptions, cursors, and subprograms available. The body fully defines cursors and subprograms, and so implements the specification. Two advantages of packages are: Modular approach, encapsulation/hiding of business logic, security, performance improvement, re-usability. They support object-oriented programming features like function overloading and encapsulation. Using package variables one can declare session level (scoped) variables, since variables declared in the package specification have a session scope.
Views: 10981 radhikaravikumar
Oracle SQL Tutorial 18 - How to Create Foreign Keys
 
07:09
In this video we are going to be creating foreign keys. I highly recommend watching the previous video before you watch this one. Essentially, we are creating a very simple database for a system where we can create projects and add people to those projects. We started with the users table: --Delete the table if needed: --DROP TABLE users; CREATE TABLE users( user_id NUMBER, username VARCHAR2(50 CHAR) UNIQUE, CONSTRAINT users_pk PRIMARY KEY (user_id) ); Now we are going to create a table for projects with a column that is a foreign key to the username. We're going to want to make this match data types: CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) ) Next, we need to add the column attributes we decided on last video: CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL ) NOT NULL because we want every project to have a creator, but we are not labeling UNIQUE because that means we could only have a specific username once in the table. We want to allow a user to create multiple projects. We also need to add a primary key: CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL, CONSTRAINT projects_pk PRIMARY KEY (username) ) Now, the question that remains is, how can I tell Oracle that I want the username to reference the username column of the other table? We have to make a foreign key constraint. As you've learned from the previous videos, there are about three ways to create constraints. You can do it inline at the column level, unnamed. You can do it at the column level, named, and you can do it at the Table level, named. Usually the table-level is preferred, but I will quickly remind you how to do all three again. CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL REFERENCES users (username), CONSTRAINT projects_pk PRIMARY KEY (project_id) ) This works, but if we want to name it, we should do this: CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL CONSTRAINT projects_users_fk REFERENCES users (username), CONSTRAINT projects_pk PRIMARY KEY (project_id) ) This works, but the preferred method is to do it at the table level: CREATE TABLE projects( project_id NUMBER, project_name VARCHAR2(50 CHAR) UNIQUE, creator VARCHAR2(50 CHAR) NOT NULL, CONSTRAINT projects_pk PRIMARY KEY (project_id), CONSTRAINT projects_users_fk FOREIGN KEY (creator) REFERENCES users (username) ) Great! So you've learned how to create a foreign key, now we can see it inside of Oracle SQL Developer. One important thing when it comes to foreign keys is what happens when have data in your database and you try to delete the parent row that a row in the child table references? In the next video we are going to configure that using ON DELETE. See you all then and if you enjoy this series, please do me a huge favor by liking the video and subscribing to my YouTube channel. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELP ME! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Views: 17627 Caleb Curry
SQL tutorial 19: ON DELETE SET NULL clause of Foreign Key By Manish Sharma (RebellionRider)
 
07:44
SQL Tutorial 19 : ON DELETE SET NULL foreign key Clause. Links used in the tutorial On delete set null website article [ download SQL script from same link] : http://www.rebellionrider.com/on-delete-set-null.htm Foreign Key Tutorial Video : http://youtu.be/0nbkBI5r3Gw Foreign Key Tutorial Blog : http://www.rebellionrider.com/sql-foreign-key.htm This video is the part of foreign key video In this sql tutorial you will learn the referential clause ON DELETE SET NULL of foreign key. On Delete Set null clause guarantee the relation integrity in foreign key/ Tool used in this tutorial is SQL Developer. This tutorial series is part of SQL expert exam certification training. if you are preparing for SQL certification you can use my tutorials. This SQL Tutorial is a part of free training. Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=j7eYO7 Contacts E-Mail [email protected] Twitter https://twitter.com/rebellionrider Instagram http://instagram.com/rebellionrider Facebook. https://www.facebook.com/imthebhardwaj Linkedin. http://in.linkedin.com/in/mannbhardwaj/ Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com
Views: 46687 Manish Sharma
Oracle REPLACE Function
 
03:55
https://www.databasestar.com/oracle-replace/ The Oracle REPLACE function is a string manipulation function that allows you to replace one text string with another. It can be a whole word or sentence, or even a single value. The syntax of the REPLACE function is: REPLACE ( whole_string, string_to_replace, [replacement_string]) To use this function, the parameters are: - whole_string (mandatory): This is the string that will be checked for the characters to be replaced. - string_to_replace (mandatory): This is the string that will be searched for within whole_string. - replacement_string (optional): This is the string that will be used to replace occurrences of string_to_replace. Because the last parameter is optional, if it is not specified, then the Oracle REPLACE function removes all occurrences of string_to_replace. You can replace carriage returns with REPLACE, but you’ll need to use the CHR function. You can replace NULL values in Oracle, but this is best done with another function such as NVL, rather than REPLACE. If you want to replace multiple characters, you can do this using nested REPLACE functions or a REGEXP_REPLACE function. For more information about the Oracle REPLACE function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-replace/
Views: 901 Database Star
Oracle PL/SQL - IF THEN ELSIF Statement
 
09:07
http://plsqlzerotopro.com This tutorial explains IF THEN ELSE IF statement.
Views: 6321 HandsonERP
Introduction to NULLIF, ISNULL, and COALESCE in SQL Server 2005/2008
 
23:13
This video is part of LearnItFirst's Writing Queries for SQL Server (2005/2008 Edition) course. More information on this video and course is available here: http://www.learnitfirst.com/Course160 In the previous video Scott highlighted the three different ways to deal with NULLs in expressions. In this video each of these different methods, NULLIF, ISNULL, and COALESCE will be detailed and demonstrated. Highlights from this video: - NULLIF - ISNULL - COALESCE - Syntax - Difference between COALESCE and ISNULL and much more...
Views: 16965 LearnItFirst.com