SQL / Java Questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is the difference between an instance variable and a local variable

- Instance variables are declared inside a class but not within a method. - Local variables are declared within a method. *** Local variables must be initialized before use

What types of inheritance are included in Java?

1. Single 2. Multilevel 3. Hierarchical 4. Multiple (Not through class) 5. Hybrid Draw diagram of each

List the set of aggregate functions in SQL.

AVG(), COUNT(), SUM(), MAX(), MIN(),

How long does an alias for a column or table last?

An alias only exists for the duration of the query.

Table columns are also known as?

Attributes

Which SQL statement is used to create a table in a database?

CREATE TABLE

Which SQL statement is used to delete data from a database?

DELETE

Write the command to remove all employees named John from the EMPLOYEE table.

DELETE FROM EMPLOYEE WHERE firstName = "John";

Which SQL command is used to insert a row?

INSERT INTO

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName) VALUES ('Olsen');

What is cardinality in SQL?

In the database world, cardinality has to do with the counts in a relationship, one-to-one, one-to-many, or many-to-many.

What SQL clauses is used to select data from 2 or more tables?

JOIN

Which operator is used to search for a specified pattern in a column?

LIKE

Which SQL keyword is used to sort the result-set?

ORDER BY

What does RDBMS stand for?

Relational Database Management System

Which SQL statement is used to extract data from a database?

SELECT

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

SELECT * FROM Persons ORDER BY FirstName DESC;

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

SELECT * FROM Persons WHERE FirstName LIKE 'a%';

With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson';

Get unique department from employee table

SELECT DISTINCT department FROM employee;

With SQL, how do you select a column named "FirstName" from a table named "Persons"?

SELECT FirstName FROM Persons;

Get FIRST_NAME from employee table after removing white spaces from left side

SELECT LTRIM(First_Name) FROM employee;

Get First_Name from employee table after replacing 'o' with '$'

SELECT REPLACE(FIRST_NAME, 'o', '$') from employee;

Get FIRST_NAME from employee table after removing white spaces from right side

SELECT RTRIM(First_Name) FROM employee;

Get position of 'o' in name 'John' from employee table

SELECT instr(First_Name,'o') From employee Where First_Name = "John";

Get length of FIRST_NAME from employee

SELECT length(FIRST_NAME) from employee

Get First_Name from employee table in lower case

SELECT lower(First_Name) From employee;

Select first 3 characters of FIRST_NAME from EMPLOYEE

SELECT substr(FIRST_NAME,0,3) FROM employee;

Get First_Name from employee table in upper case

SELECT upper(First_Name) From employee;

What is an aggregate function is SQL?

SQL aggregate functions return a single value, calculated from values in a column.

What does SQL stand for?

Structured Query Language

class A { int i; void methodOne() { System.out.println("From methodOne"); } } class B extends A { int j; void methodTwo() { System.out.println("From methodTwo"); } } Which class is the subclass and which is the super class?

Super Class: Class A Sub Class: Class B

What are the differences between primary and foreign keys?

The primary key is the column or set of columns used to uniquely identify the items in a table. A foreign key is used to uniquely identify the items in a different table, allowing join operations to happen.

What is the purpose of using abstract classes and interfaces?

To create abstraction, allowing declaration of abstract methods

Which SQL statement is used to update data in a database?

UPDATE

What is TRUNCATE TABLE used for?

Used to delete complete data from an existing table.

Can you use both HAVING and WHERE SQL clauses in one SQL statement?

Yes

Does Java have an XOR operator? If so, what is the representation for XOR in Java?

Yes, Java does have an XOR (Exclusive Or) operator - it is represented by the caret character - the "^".

Is the BETWEEN Operator inclusive?

Yes, begin and end values are included.

Can you sort a column using a column alias?

Yes. A column alias could be used in the ORDER BY clause.

What is the NULL keyword used to do?

represent a missing or unknown value. NULL in SQL represents nothing.


संबंधित स्टडी सेट्स

Các từ lóng tiếng Anh mà teen Mỹ hay dùng

View Set

AP Human Geography: MDC Monuments Test

View Set

Automotive Final Flashcards(ENGINER&R,PAINTING,BOLTID)

View Set

Worksheets 1 + 2 _ Webster City US history

View Set

Anthropology and the Study of Culture

View Set

Chapter 14 section 1 and section 2

View Set

Davis Advantage Chp 10 Older Adult

View Set

Chapter 10: Documentation and Communication

View Set

Exam 1 Reading questions RelA250

View Set

Med Surg 1 Chapter 31 (Respiratory Disorders)

View Set