answersLogoWhite

0

📱

Database Programming

Databases are collections of tables that maintain and display information, often collaboratively; this information can be used for interaction with an application or gaining general knowledge. Questions about database engines and modifying or using them belong in this category.

8,803 Questions

Salient features of SQL?

Database Mirroring-->

Extend log shipping capabilities with the database mirroring solution. You will be able to use database mirroring to enhance availability of your SQL Server systems by setting up automatic failover to a standby server.

Online Restore-->

With SQL Server 2005, database administrators are able to perform a restore operation while an instance of SQL Server is running. Online restore improves the availability of SQL Server because only the data being restored is unavailable; the rest of the database remains online and available.

Online Indexing Operations-->

The online index option allows concurrent modifications (updates, deletes, and inserts) to the underlying table or clustered index data and any associated indexes during index data definition language (DDL) execution. For example, while a clustered index is being rebuilt, you can continue to make updates to the underlying data and perform queries against the data.

Fast Recovery-->

A new faster recovery option improves availability of SQL Server databases. Administrators can reconnect to a recovering database after the transaction log has been rolled forward.

How do you make a graph on graph paper?

First make a table of values, then draw axes and label them appropriately

Then plot points carefully, and join with a curve or line (the particular way of drawing the line depends on the type of graph: scientific, scatter or mathematical.)

Scientific graphs have values resulting from experiments. You draw a curve that follows the general trend of the points. (And passes within experimental error of the points) Scatter graphs are plotted with a straight line of best fit. Mathematical graphs should be joined with curves that pass exactly through the points.

What are the entities and attributes of the banking system?

These would be the assets that the bank owns. It could include stocks, the buildings, outside interests, and anything that makes up the business.

Modes of data transmission?

Data can be transferred in 3 different modes, these 3 modes are equally popular and used in common everyday situations.

•Simplex

If data can only be transferred in a single direction (one way) it is known as simplex. Television transmission is an example of Simplex transmission, here data can be transferred only to a television but no data can be transferred in the opposite direction.

•Duplex

When data maybe transferred in two directions simultaneously it is known as Duplex, a simple telephone conversation would be an example, while we usually don't talk simultaneously a telephone provides that 'duplex' functionality.

•Half-Duplex

In this mode of transmission as well, data maybe transmitted in both directions, however it cannot be done simultaneously. A Walkie Talkie would be an example of this mode of transmission.

The different modes are implemented based on their requirements, for example in Simplex transmission, two way transmission is not required in television transmission thus Simplex is used.

Can weak entity be converted into strong entity in DBMS?

A weak entity set can always be make into strong entity set by adding to its attribute of its identifying entity set. For a weak entity set, we add columns to the table corresponding to the primary key of the strong entity set on which the weak set is dependent.

What are the requirements for a database administrator to perform his duties?

to manipulate the masterfile tables through the use and methods of stenographic software and watermark programing installs.

How do you view all the tables created in the database?

View is a virtual table with no data , but can be operated like any other table. It is like a virtual table through which you can view data of another table, which is known as the base table. Syntax for creating a view- CREATE VIEW as SELECT statement ;

Sql select to return one value?

It depends on the DBMS

MSSQL: SELECT TOP 1 column FROM table

MySQL: SELECT column FROM table LIMIT 0,1 (start index, number of rows to get)

Describe the overall structure of a general database management system?

DBMS (Database Management System) acts as an interface between the user and the database. The user requests the DBMS to perform various operations (insert, delete, update and retrieval) on the database. The components of DBMS perform these requested operations on the database and provide necessary data to the users. The various components of DBMS are shown below: -

Fig. 2.1 Structure Of DBMS

1. DDL Compiler - Data Description Language compiler processes schema definitions specified in the DDL. It includes metadata information such as the name of the files, data items, storage details of each file, mapping information and constraints etc.

2. DML Compiler and Query optimizer - The DML commands such as insert, update, delete, retrieve from the application program are sent to the DML compiler for compilation into object code for database access. The object code is then optimized in the best way to execute a query by the query optimizer and then send to the data manager.

3. Data Manager - The Data Manager is the central software component of the DBMS also knows as Database Control System.

The Main Functions Of Data Manager Are: --

• Convert operations in user's Queries coming from the application programs or combination of DML Compiler and Query optimizer which is known as Query Processor from user's logical view to physical file system.

• Controls DBMS information access that is stored on disk.

• It also controls handling buffers in main memory.

• It also enforces constraints to maintain consistency and integrity of the data.

• It also synchronizes the simultaneous operations performed by the concurrent users.

• It also controls the backup and recovery operations.

4. Data Dictionary - Data Dictionary is a repository of description of data in the database. It contains information about

• Data - names of the tables, names of attributes of each table, length of attributes, and number of rows in each table.

• Relationships between database transactions and data items referenced by them which is useful in determining which transactions are affected when certain data definitions are changed.

• Constraints on data i.e. range of values permitted.

• Detailed information on physical database design such as storage structure, access paths, files and record sizes.

• Access Authorization - is the Description of database users their responsibilities and their access rights.

• Usage statistics such as frequency of query and transactions.

Data dictionary is used to actually control the data integrity, database operation and accuracy. It may be used as a important part of the DBMS.

Importance of Data Dictionary -

Data Dictionary is necessary in the databases due to following reasons:

• It improves the control of DBA over the information system and user's understanding of use of the system.

• It helps in documentating the database design process by storing documentation of the result of every design phase and design decisions.

• It helps in searching the views on the database definitions of those views.

• It provides great assistance in producing a report of which data elements (i.e. data values) are used in all the programs.

• It promotes data independence i.e. by addition or modifications of structures in the database application program are not effected.

5. Data Files - It contains the data portion of the database.

Explain the term entity?

1 a : being, existence; especially :independent, separate, or self-contained existence

Explain architecture of Distributed Database systems Also explain the reasons for building distributed database systems?

1 Explain architecture of Distributed Database systems? Also, explain the reasons for building distributed database systems?

Describe the basic features of the relational data model and discuss their importance to the end user and the designer?

This model helps you to get everything to work together. You can bring in little details and not worry about them getting lost.

What are Cartesian joins.?

it means cross product. so if you have 3 male and 2 female, how many couple combination we can have. 2 X 3 = 6.

Is medisoft a database program?

Yes, Medisoft runs on the "Advantage Database" engine. It supports ODBC drivers as well, and data can be extracted using the ARC32 application.

Many reporting capabilities are available with the Medisoft Reports program that pulls data from it's database.

It keeps track of patient information (name, age, insurance, many more fields) as well as patient scheduling (type of service, date, time, provider, and many more).

What do most database designer prefer 1NF 2NF or 3NF?

First normal form (1NF) sets the very basic rules for an organized database: * Eliminate duplicative columns from the same table. * Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key). Second normal form (2NF) further addresses the concept of removing duplicative data: * Meet all the requirements of the first normal form. * Remove subsets of data that apply to multiple rows of a table and place them in separate tables. * Create relationships between these new tables and their predecessors through the use of foreign keys. Third normal form (3NF) goes one large step further: * Meet all the requirements of the second normal form. * Remove columns that are not dependent upon the primary key. Finally, fourth normal form (4NF) has one additional requirement: * Meet all the requirements of the third normal form. * A relation is in 4NF if it has no multi-valued dependencies. Remember, these normalization guidelines are cumulative. For a database to be in 2NF, it must first fulfill all the criteria of a 1NF database.

Create view in SQL?

create view vw_active_employee

as

select * from employee

where status = 'Active'

after creating the view, view can be used as a table to see active employee.

e.g. select * from vw_active_employee

Basically we save sql as a database object, so that we can use that in future as a virtual table.

Date functions in sql?

Dates in SQL can be confusing for beginners since the format of the date in the database must match the date format entered when inserting data. Datetime is often used in place of the date in various situations.

In MySQL RDBMS, the default date functions are:

Sr.No. Function & Description

1 ADDDATE()

Adds dates

2 ADDTIME()

Adds time

3 CONVERT_TZ()

Converts from one timezone to another

4 CURDATE()

Returns the current date

5 CURRENT_DATE(), CURRENT_DATE

Works the same as CURDATE()

6 CURRENT_TIME(), CURRENT_TIME

Works the same as CURTIME()

7 CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP

Works the same as NOW()

8 CURTIME()

Returns the current time

9 DATE_ADD()

Adds two dates

10 DATE_FORMAT()

Formats date as specified

11 DATE_SUB()

Subtracts two dates

12 DATE()

Extracts the date part of a date or datetime expression

13 DATEDIFF()

Subtracts two dates

14 DAY()

Synonym for DAYOFMONTH()

15 DAYNAME()

Returns the name of the weekday

16 DAYOFMONTH()

Returns the day of the month (1-31)

17 DAYOFWEEK()

Returns the weekday index of the argument

18 DAYOFYEAR()

Returns the day of the year (1-366)

19 EXTRACT

Extracts part of a date

20 FROM_DAYS()

Converts a day number to a date

21 FROM_UNIXTIME()

Formats date as a UNIX timestamp

22 HOUR()

Extracts the hour

23 LAST_DAY

Returns the last day of the month for the argument

24 LOCALTIME(), LOCALTIME

Synonym for NOW()

25 LOCALTIMESTAMP, LOCALTIMESTAMP()

Synonym for NOW()

26 MAKEDATE()

Creates a date from the year and day of year

27 MAKETIME

Returns a time value calculated from the hour, minute and second arguments.

28 MICROSECOND()

Returns the microseconds from argument

29 MINUTE()

Returns the minute from the argument

30 MONTH()

Return the month from the date passed

31 MONTHNAME()

Returns the name of the month

32 NOW()

Returns the current date and time

33 PERIOD_ADD()

Adds a period to a year-month

34 PERIOD_DIFF()

Returns the number of months between periods

35 QUARTER()

Returns the quarter from a date argument

36 SEC_TO_TIME()

Converts seconds to 'HH:MM:SS' format

37 SECOND()

Returns the second (0-59)

38 STR_TO_DATE()

Converts a string to a date

39 SUBDATE()

When invoked with three arguments a synonym for DATE_SUB()

40 SUBTIME()

Subtracts times

41 SYSDATE()

Returns the time at which the function executes

42 TIME_FORMAT()

Formats as time

43 TIME_TO_SEC()

Returns the argument converted to seconds

44 TIME()

Extracts the time portion of the expression passed

45 TIMEDIFF()

Subtracts time

46 TIMESTAMP()

With a single argument this function returns the date or datetime expression. With two arguments, the sum of the arguments

47 TIMESTAMPADD()

Adds an interval to a datetime expression

48 TIMESTAMPDIFF()

Subtracts an interval from a datetime expression

49 TO_DAYS()

Returns the date argument converted to days

50 UNIX_TIMESTAMP()

Returns a UNIX timestamp

51 UTC_DATE()

Returns the current UTC date

52 UTC_TIME()

Returns the current UTC time

53 UTC_TIMESTAMP()

Returns the current UTC date and time

54 WEEK()

Returns the week number

55 WEEKDAY()

Returns the weekday index

56 WEEKOFYEAR()

Returns the calendar week of the date (1-53)

57 YEAR()

Returns the year

58 YEARWEEK()

Returns the year and week

How do you execute cplusplus program in unix using sql as back end?

The program needs to be designed to do that. If it is, then it will either be designed to use a TCP connection (e.g. on port 3306) to the database or a named socket (e.g. mysql.sock). All you'll really need to do is start the database engine, create the necessary databases, grant rights to whatever database user the program calls into the DB as, pre-populate any necessary tables/data the program expects to be there, and then start the program. The program documentation should tell you what you need to provide as far as a mysql environment and give any necessary SQL initialization scripts.

How can you access BIOS on emachines?

Upon starting the computer, there is a couple of moments befor you get the "Windows screen that the screen displays ( in the lower right hand corner ) two typed lines...one of which says Bios and gives a number of a key on your keyboard for you to clic on...which you must do within a couple of seconds for it to work...if the time goes by befor you get to do this, turn off the computer and start again...

Its the DEL or F2 key. http://michaelstevenstech.com/bios_manufacturer.htm has a good list of many manufacturer's bios keys also.

In c How do you access variable declared in main in other function?

Only if you pass a pointer to it, eg:

void sub (int *into)

{

*into= 3;

}

int main (void)

{

int myvariable;

sub (&myvariable);

return 0;

}

How do you completely delete data beyond retrival?

You can always use a free program calledEraser.
This option however is only available for PC users running Windows.
The software is open source and can be downloaded from its own web site at http:/eraser.heidi.ie