Tag Info

New answers tagged

2

Provide a name for the constraint: SQL> create table monkey(tail_count number); Table created. SQL> insert into monkey values (null); 1 row created. SQL> alter table monkey modify tail_count not null; alter table monkey modify tail_count not null * ERROR at line 1: ORA-02296: cannot enable (ANIMAL.) - null values found SQL> alter table ...


0

I believe you could just use: select * from ANIMAL.MONKEY where TAIL_COUNT is null; to identify problematic rows, or add clause NOVALIDATE at the end of your alter statement.


5

Very short answer : No new datatypes have been created to accommodate you. While we are on this subject Let's try plain SQL USE test DROP TABLE IF EXISTS numtest; CREATE TABLE numtest ( id int not null auto_increment, xx decimal(10,3) default null, primary key (id) ); INSERT INTO numtest (id) values (0),(0),(0),(0),(0); SELECT * FROM numtest; ...


1

First observation is that your update statement has no WHERE clause. This means that it will update all rows of the table. Are you sure you want that? From the comments, it seems that all rows have year_period = 2016 and you do want to update all of them. In my opinion, it wouldn't hurt to explicitly add this condition in the statement. The opposite, it ...


1

Adding the column: alter table device_login add column person_id int ; The query is a bit complicated, due to the nulls. First group the not null logins per login and keep each null seprately with a as ( select min(device_id) as device_id, login_id from device_login where login_id is not null group by login_id union all select device_id, ...


3

You are touching on an almost philosophical argument here: should NULLable values be allowed at all given they violate the "closed world" assumption of the model relational databases are derived from (see relevant sections of http://en.wikipedia.org/wiki/Null_(SQL) and a number of other questions here such as Why shouldn't we allow NULLs? for more notes ...


1

Whether a separate table for images is helpful depends on the cardinality of the relationship between the images and the rest of the attributes in the original table: A separate image-table is justifiable if either: multiple rows may contain the same image: enhances normalization since the image only has to be stored once in the image table instead of ...


-2

If you create a new table then you would probably need a "JOIN" to get the image data. Joins can decrease performance of RDBMS. But in your case as there would be only one join so it won't have that much effect on over-all query performance.


1

You need to apply the function (Nz) that replaces the null with another value before the week function call. Use: week( Nz(Tab2.y, Value_for_y) , Nz(Tab2.w, Value_for_w) ) You probably also need tests against the special Value_for_y or Value_for_w inside week().


1

Possibilities, you can: use the BDB-Storage engine in MySQL prior 5.1. which treats nulls as non-distinct to each other. Later versions don't support BDB introduce a special value for "no kid_id", so you won't have nulls add a not-null pseudo column, which is filled by triggers and has to be in the constraint instead of the original kid_id use a ...



Top 50 recent answers are included