prathmeshyelne has Published 58 Answers

Write C Program to Delete duplicate elements from an array

Published on 19-Dec-2021 17:47:06
Program : To delete duplicate elements in an array #include <stdio.h> int main() { int arr[20], i, j, k, size; printf("\nEnter array size : "); scanf("%d", &size); printf("\nAccept Numbers : "); for (i = 0; i < size; i++) scanf("%d", &arr[i]); printf("\nArray with Unique list : "); for (i = 0; i < size; i++) { for (j = i + 1; j < size;) { if (arr[j] == arr[i])... Read More

Write a C program using pointers to read in an array of integers and print its elements in reverse order.

Published on 19-Dec-2021 17:39:45
#include <stdio.h> #include <conio.h> #define MAX 30 void main() { int size, i, arr[MAX]; int *ptr; clrscr(); ptr = &arr[0]; printf("\nEnter the size of array : "); scanf("%d", &size); printf("\nEnter %d integers into array: ", size); for (i = 0; i < size; i++) { scanf("%d", ptr); ptr++; } ptr = &arr[size - 1]; printf("\nElements of array in reverse order are :"); for (i = si... Read More

How to Implement Stack Operations Using Array using C

Published on 18-Dec-2021 18:27:23
Program for implementing a stack using arrays.It involves various operations such as push,pop,stack empty,stack full and display. #include <stdio.h> #include <conio.h> #include <stdlib.h> #define size 5 struct stack { int s[size]; int top; } st; int stfull() { if (st.top >= size - 1) return 1; else return 0; } void push(int item) { st.top++; st.s[st.top] = item; } int... Read More

How to find the nth highest salary in SQL ?

Published on 16-Dec-2021 16:52:22
This is how we can find the nth highest salary in SQL SERVER using TOP keyword: SELECT TOP 1 salary FROM ( SELECT DISTINCT TOP N salary FROM Employee ORDER BY salary DESC ) AS temp ORDER BY salary This is how we can find the nth highest salary in MYSQL using LIMIT keyword: SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1 ... Read More

How to insert multiple rows in SQL ?

Published on 16-Dec-2021 16:49:13
To insert multiple rows in SQL we can follow the below syntax: INSERT INTO table_name (column1, column2,column3...) VALUES (value1, value2, value3…..), (value1, value2, value3….), ... (value1, value2, value3); We start off by giving the keywords INSERT INTO then we give the name of the table into which we would want to insert the values. We will follow it up with the list of the columns, for which we would have to a... Read More

What is a trigger in SQL ?

Published on 16-Dec-2021 16:46:22
A trigger is a stored program in a database which automatically gives responses to an event of DML operations done by insert, update, or delete. In other words, is nothing but an auditor of events happening across all database tables. Let’s look at an example of a trigger : CREATE TRIGGER bank_trans_hv_alert BEFORE UPDATE ON bank_account_transaction FOR EACH ROW begin if( abs(:new.transaction_amount)>999999)THEN RAISE_APPL... Read More

What is SQL injection ?

Published on 16-Dec-2021 16:43:22
SQL injection is a hacking technique which is widely used by black-hat hackers to steal data from your tables or databases. Let’s say, if you go to a website and give in your user information and password, the hacker would add some malicious code over there such that, he can get the user information and password directly from the database. If your database contains any vital information, it is always better to keep it secure from SQL injection ... Read More

What is a unique key in SQL ?

Published on 16-Dec-2021 16:40:54
Unique Key is a constraint in SQL. So, before understanding what exactly is a primary key, let’s understand what exactly is a constraint in SQL. Constraints are the rules enforced on data columns on a table. These are used to limit the type of data that can go into a table. Constraints can either be column level or table level. Unique Key:  Whenever we give the constraint of unique key to a column, this would mean that the column cannot ... Read More

How to delete a column in SQL ?

Published on 16-Dec-2021 16:39:14
To delete a column in SQL we will be using DROP COLUMN method: ALTER TABLE employees DROP COLUMN age; We will start off by giving the keywords ALTER TABLE, then we will give the name of the table, following which we will give the keywords DROP COLUMN and finally give the name of the column which we would want to remove.... Read More

What is a schema in SQL ?

Published on 16-Dec-2021 16:35:48
Our database comprises of a lot of different entities such as tables, stored procedures, functions, database owners and so on. To make sense of how all these different entities interact, we would need the help of schema. So, you can consider schema to be the logical relationship between all the different entities which are present in the database. Once we have a clear understanding of the schema, this helps in a lot of ways: We can decide... Read More