Bharti Kumari

Bharti Kumari

21 Articles Published

Articles by Bharti Kumari

21 articles

Java program to combine two list by alternatively taking elements

Bharti Kumari
Bharti Kumari
Updated on 21-Aug-2024 2K+ Views

Introduction The Java program to combine two lists by alternatively taking elements is a simple code snippet that takes in two lists of any type of object that can be stored in a list and returns a new list that contains elements from both input lists alternately. The program defines a method called alternateMerge that takes two lists as input and returns a new list that contains elements from both lists alternately. It determines the size of both lists and loops through the larger of the two lists. For each index in the loop, it adds the element from the ...

Read More

SQL Query to Convert Rows to Columns in SQL Server

Bharti Kumari
Bharti Kumari
Updated on 22-Oct-2023 32K+ Views

Introduction The PIVOT operator is used to rotate rows of a table into columns. It is useful for generating cross-tabular reports, where the results are presented in a summary form. The PIVOT operator is available in SQL Server 2005 and later versions. The PIVOT operator is used to convert rows into columns in a SQL Server database. It is often used to generate cross-tabular reports, where the results are presented in a summary form. Definition In SQL Server, the PIVOT operator allows you to convert rows into columns. It is useful for generating cross-tabular reports, where the results are ...

Read More

How to List All Tables in a Schema in Oracle Database?

Bharti Kumari
Bharti Kumari
Updated on 04-Oct-2023 52K+ Views

Introduction In Oracle databases, a schema is a logical grouping of related objects, such as tables, views, and stored procedures. Each schema belongs to a specific database user and has a set of associated privileges. To list all tables in a schema in an Oracle database, you can use one of the views in the data dictionary. The `ALL_TABLES` view contains one row for each table in the current schema, while the `DBA_TABLES` view contains one row for each table in the entire database. To list the tables in a schema, you can use a SELECT statement to query the ...

Read More

How to Update Two Tables in One Statement in SQL Server?

Bharti Kumari
Bharti Kumari
Updated on 14-Sep-2023 53K+ Views

Introduction In SQL Server, you may sometimes need to update data in multiple tables at the same time. This can be done using a single UPDATE statement, which allows you to update multiple tables in a single query. To update two tables in one statement, you can use the UPDATE statement with a JOIN clause. The JOIN clause allows you to specify a relationship between the two tables that you want to update, based on a common column or set of columns. Definition The term "update two tables in one statement" refers to the process of using a single UPDATE ...

Read More

How to Convert Epoch Time to Date in SQL?

Bharti Kumari
Bharti Kumari
Updated on 02-Sep-2023 72K+ Views

Introduction The epoch is the date and time relative to which a computer's clock and timestamp values are determined. Epoch time is commonly used in computer systems to represent a point in time. It is typically represented as a single integer value, which represents the number of seconds that have elapsed since the epoch. In SQL, you can convert an epoch time value to a date by using the to_timestamp() function. This function converts an epoch time value (which is typically stored as a BIGINT or INT data type) to a timestamp with time zone value. The resulting timestamp value ...

Read More

Java Program to Compute the Sum of Numbers in a List Using For-Loop

Bharti Kumari
Bharti Kumari
Updated on 10-Apr-2023 4K+ Views

Introduction Java is a popular programming language that is used for developing a wide range of applications, including those that involve working with lists of numbers. One common task is to compute the sum of numbers in a list, which can be accomplished using a for-loop. In this approach, we first create a list of numbers, then initialize a variable to hold the sum. We then use a for-loop to iterate over each element in the list, adding it to the sum variable. After the loop has completed, the sum variable contains the total sum of all the numbers in ...

Read More

Java Program to Compute the Area of a Triangle Using Determinants

Bharti Kumari
Bharti Kumari
Updated on 10-Apr-2023 495 Views

Introduction The Java program to compute the area of a triangle using determinants is a concise and efficient program that calculates the area of a triangle given the coordinates of its three vertices. This program is useful for anyone studying or working with geometry, as it demonstrates how to use basic arithmetic and algebraic calculations in Java, and how to read in user input using the Scanner class. The program prompts the user to enter the coordinates of three points of the triangle, which are then read in and used to calculate the determinant of the matrix of coordinates. The ...

Read More

Java Program to Check the Accessibility of an Static Variable By a Static Method

Bharti Kumari
Bharti Kumari
Updated on 10-Apr-2023 367 Views

Introduction In Java, we can define variables and methods as static. A static variable or method belongs to the class itself rather than to the individual objects of the class. Therefore, we can access a static variable or method using the class name, without creating an object of the class. In this program, we will explore how to check the accessibility of a static variable by a static method. We will define a class with a static variable and a static method that accesses the variable. We will then call the static method to check if it can access the ...

Read More

Strategies For Migrating From SQL to NoSQL Database?

Bharti Kumari
Bharti Kumari
Updated on 27-Jan-2023 784 Views

Introduction Migrating from a SQL to a NoSQL database is a significant undertaking that requires careful planning and strategizing. It's important to understand the differences between these two types of databases and to identify the specific use cases for which you will be using the NoSQL database. There are several different tools and techniques available for migrating data from a SQL to a NoSQL database, and it's important to carefully evaluate the pros and cons of each option to determine the best fit for your needs. Migrating from a SQL to a NoSQL database can be a significant undertaking and ...

Read More

SQL Server Query to Find All Permissions/Access for All Users in a Database

Bharti Kumari
Bharti Kumari
Updated on 27-Jan-2023 46K+ Views

Introduction In SQL Server, permissions are used to control access to database objects, such as tables and views. Each user in a database has a set of permissions that determine what they are able to do within the database, such as SELECT, INSERT, UPDATE, DELETE, and EXECUTE. To view the permissions that a user has been granted in a database, you can use the sys.database_permissions view. This view provides information about the permissions that have been granted or denied on database-level securables for a specific database. The sys.objects view contains information about all the objects in a database, and the ...

Read More
Showing 1–10 of 21 articles
« Prev 1 2 3 Next »
Advertisements