SQL: Using NULL values vs. default values
What are the pros and cons of using NULL values in SQL as opposed to default values? PS. Many similar questions has been asked on here but none answer my question. ...
What are the pros and cons of using NULL values in SQL as opposed to default values? PS. Many similar questions has been asked on here but none answer my question. ...
Hi I have an execl datasheet with data looking like this id desc part no 1 Qty 1 part no 2 Qty 2 part no 3 Qty 3 1 PartsName 382A012-3-0 3 382A023-3 3 382A012-25 3 And need it to look like this id desc part no Qty 1 PartsName 382A012-3-0 3 1 Part...
Hi, I've started learning Prolog and wondering about theoritical difference from SQL language. For example they are both declarative paradigma languages, both support fact-driven knowledge database, both support question-styled data-retrieving, both support functional dependencies. So does anybody have an idea? Tnx in advance. ...
Hello, I'm searching for a simple way to delete all data from a database and keep the structure (table, relationship, etc...). I using postgreSQL but I think, if there a command to do that, it's not specific to postgres. Thanks, Damien ...
Hi, We're having an issue with a poorly coded SQL function(which works fine in live, but not in our test environment). This function is used to provide a default value in many tables, trying to ALTER the function returns a "Cannot ALTER ### because it is being referenced by object" error. Is there any way round this error message? T...
Hello, I have a SQL question. I'm working with the following set of tables: http://imgur.com/eg19r.png The Recipe table contains 5 recipes, Ingredient contains many ingredients (52), and IngredientList is an associative entity, an implementation of the many-to-many relationship between Recipe and Ingredient. RecipeID and IngredientI...
I want to do query as below. Query is wrong but describes my intentions. SELECT name, dateTime, data FROM Record WHERE dateTime = MAX(dateTime) Update: Ok. The query describes intentions not quite good. My bad. I want to select latest record for each person. ...
Hello all! I got a question regarding my MySQL-database and would like to get input on what would be most efficient. My problem is as follows, I'm developing premium functionality for my board game web site. One premium functionality would be that all the games a user has played would be stored "forever" (for the user to look up after...
I'm writing a desktop java app on that I want to connect to a MySQL database on a server. Here is the code to do that: import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; private static Connection getDBConnection() throws SQLException, InstantiationException, IllegalAcces...
I'm trying to add a 'not null' constraint to a column in Oracle 9. ALTER TABLE user_roles modify group_id varchar2(36 char) set not null; However, the operation fails with an odd error: Error report: SQL Error: ORA-12987: cannot combine drop column with other operations 12987. 00000 - "cannot combine drop column with other operation...
hello ! I have a problem,I run application C# and I get a error "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (p...
I have two table fields in a MySQL table. One is VARCHAR and is a "headline" for a classified (classifieds website). The other is TEXT field which contains the "text" for the classified. Two Questions: How should I determine how to index these two fields? (what field-type, what classes to use etc) Currently I have an "ad_id" as a uniq...
Based on this link it looks like I can get date inserted / date modified information "for free" (without the need for triggers etc.) using Sql Server 2008 by simply enabling Change Tracking. I am using Entity Framework to access the data. My question is, how do I access date modified / date inserted information for the database records...
Hi, I have a SQL table "ITM_SLS" with the following fields: ITEM DESCRIPTION TRANSACTION # DATE QTY SOLD I want to be able to output QTY SOLD for a one month value and a year to date value so that the output would look like this: ITEM, DESCRIPTION, QTY SOLD MONTH, QTY SOLD YEAR TO DATE Is this possible? ...
how can i delete from table A while comparing two fields A.P and A.C to table B's B.P and B.C while looking for all matches of B.R = 1 ? actually neither of the following work but it should go into the direction, unfortunately i can't figure out how... DELETE FROM A WHERE (A.P = B.P AND A.C = B.C where B.C = 1) DELETE FROM A WHERE (SE...
I have several stored procedures that all use the same set of parameters. Is there a way to define and save the parameter list as a reusable block of code? Something like this: CREATE PROCEDURE test Using StoredParameterList AS BEGIN SQL Statement END Is this possible? It would make code maintenance easier if a parameter n...
hi i install visual-studio 2008, part ot the installation is the sql server 2005 express. how i can manage this sql server ? is there any visual tool for making tables ? run queries ? thank's in advance ...
Hi everyone, I have two tables, landlords and properties. My properties table has; ID, Address, Postcode, lease and landlordID in it. The problem I face is: If I want to search for all the properties that have Mr.Spina as their landlord I need search the landlords database with the name "spina" to get his ID which is saved in the prope...
Hi All I would like to do a query for inserting a value calculated starting upon another table. I don't want to use Temporary tables and I would like to do everything in one singel query. It is possible? I tried this one below but it doesn't work. Thanks AFeG INSERT INTO MyTable( `DATE`, `Name`, `Total` ) VALUES ( '2010/01/01', ...
I need to work with several data samples, to say, N. The samples represent similar data but from different origins. For example, history of order in different shops. So the structure of all the samples is the same. To operate with the data I have several possibilities: Use N databases with identical schema, one for each sample Use one ...